diff --git a/src/deh_soc.c b/src/deh_soc.c index b9cb3adb9bd2482b6e5a8ecd418ce42aec189458..001c6d2896f1109ada545b3dd0625bd92479c79c 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -925,9 +925,9 @@ static void readspriteframe(MYFILE *f, spriteinfo_t *sprinfo, UINT8 frame) value = atoi(word2); // used for numerical settings if (fastcmp(word, "XPIVOT")) - sprinfo->pivot[frame].x = value; + sprinfo->frames[frame].pivot.x = value; else if (fastcmp(word, "YPIVOT")) - sprinfo->pivot[frame].y = value; + sprinfo->frames[frame].pivot.y = value; // TODO: 2.3: Delete else if (fastcmp(word, "ROTAXIS")) deh_warning("SpriteInfo: ROTAXIS is deprecated and will be removed."); diff --git a/src/lua_infolib.c b/src/lua_infolib.c index c714a6382f4db6b4d8500f1423034c3fa4e098ed..44ced92e941b1578f78bd17591c384ee3d1b275c 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -333,9 +333,9 @@ static int PopPivotSubTable(spriteinfo_t *info, lua_State *L, int stk, int idx) } // Set it if (ikey == 1 || (key && fastcmp(key, "x"))) - info->pivot[idx].x = (INT32)value; + info->frames[idx].pivot.x = (INT32)value; else if (ikey == 2 || (key && fastcmp(key, "y"))) - info->pivot[idx].y = (INT32)value; + info->frames[idx].pivot.y = (INT32)value; // TODO: 2.3: Delete else if (ikey == 3 || (key && fastcmp(key, "rotaxis"))) LUA_UsageWarning(L, "\"rotaxis\" is deprecated and will be removed.") @@ -552,8 +552,8 @@ static int pivotlist_set(lua_State *L) else if (lua_isuserdata(L, 3)) { struct PivotFrame *container = luaL_checkudata(L, 3, META_FRAMEPIVOT); - memcpy(&sprinfo->pivot[frame], - &container->sprinfo->pivot[container->frame], + memcpy(&sprinfo->frames[frame].pivot, + &container->sprinfo->frames[container->frame].pivot, sizeof(spriteframepivot_t)); okcool = 1; } @@ -573,7 +573,7 @@ static int pivotlist_num(lua_State *L) static int framepivot_get(lua_State *L) { struct PivotFrame *container = luaL_checkudata(L, 1, META_FRAMEPIVOT); - spriteframepivot_t *framepivot = &container->sprinfo->pivot[container->frame]; + spriteframepivot_t *framepivot = &container->sprinfo->frames[container->frame].pivot; const char *field = luaL_checkstring(L, 2); I_Assert(framepivot != NULL); @@ -597,7 +597,7 @@ static int framepivot_get(lua_State *L) static int framepivot_set(lua_State *L) { struct PivotFrame *container = luaL_checkudata(L, 1, META_FRAMEPIVOT); - spriteframepivot_t *framepivot = &container->sprinfo->pivot[container->frame]; + spriteframepivot_t *framepivot = &container->sprinfo->frames[container->frame].pivot; UINT8 *available = container->sprinfo->available; const char *field = luaL_checkstring(L, 2); diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index 61129d608ca5929a715d84f9e744843e37387d27..a84f0ad4a41e3d356012a0c9ef8801d8874abf04 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -98,13 +98,13 @@ patch_t *Patch_GetRotatedSprite( if (R_IsSpriteInfoAvailable(sprinfo, frame)) { - xpivot = sprinfo->pivot[frame].x; - ypivot = sprinfo->pivot[frame].y; + xpivot = sprinfo->frames[frame].pivot.x; + ypivot = sprinfo->frames[frame].pivot.y; } else if (R_IsSpriteInfoAvailable(sprinfo, SPRINFO_DEFAULT_FRAME)) { - xpivot = sprinfo->pivot[SPRINFO_DEFAULT_FRAME].x; - ypivot = sprinfo->pivot[SPRINFO_DEFAULT_FRAME].y; + xpivot = sprinfo->frames[SPRINFO_DEFAULT_FRAME].pivot.x; + ypivot = sprinfo->frames[SPRINFO_DEFAULT_FRAME].pivot.y; } else { diff --git a/src/r_picformats.c b/src/r_picformats.c index 8aa3eab5163f19ca78b39f32c403d4a7595a9cd9..84fc980a3a76f822569a85785b32b1bf08fad1e9 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -1556,18 +1556,18 @@ struct ParsedSpriteInfoFrame { INT32 pivotY; }; -static boolean define_spriteinfo_frame(struct ParsedSpriteInfoFrame *frame, spriteinfo_t *dest, UINT16 index) +static boolean define_spriteinfo_frame(struct ParsedSpriteInfoFrame *frame, spriteinfoframe_t *dest) { boolean defined = false; if (frame->pivotX != INT32_MAX) { - dest->pivot[index].x = frame->pivotX; + dest->pivot.x = frame->pivotX; defined = true; } if (frame->pivotY != INT32_MAX) { - dest->pivot[index].y = frame->pivotY; + dest->pivot.y = frame->pivotY; defined = true; } @@ -1704,7 +1704,7 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean { for (UINT16 frameIter = frameID; frameIter <= frameEndID; frameIter++) { - if (define_spriteinfo_frame(&frame, parser->info, frameIter)) + if (define_spriteinfo_frame(&frame, &parser->info->frames[frameIter])) { set_bit_array(parser->info->available, frameIter); } @@ -1712,7 +1712,7 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean } else { - if (define_spriteinfo_frame(&frame, parser->info, frameID)) + if (define_spriteinfo_frame(&frame, &parser->info->frames[frameID])) { set_bit_array(parser->info->available, frameID); } diff --git a/src/r_picformats.h b/src/r_picformats.h index 1388be01348fa078515fd6a17bc552b1575e5a04..b07b6a9485830198eafe1bd9db181850159e0e20 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -98,12 +98,17 @@ typedef struct INT32 x, y; } spriteframepivot_t; +typedef struct +{ + spriteframepivot_t pivot; +} spriteinfoframe_t; + #define SPRINFO_DEFAULT_FRAME (MAXFRAMENUM) typedef struct { UINT8 available[BIT_ARRAY_SIZE(MAXFRAMENUM + 1)]; // 1 extra for default_frame - spriteframepivot_t pivot[MAXFRAMENUM + 1]; + spriteinfoframe_t frames[MAXFRAMENUM + 1]; } spriteinfo_t; // PNG support