diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 0bcbcc5b983da37130a1ef7a1133c3a9b7193ea3..cff72deb4ccd7f5425b54b5d71d6c8a16d9bdb24 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -359,8 +359,8 @@ static int PopPivotTable(spriteinfo_t *info, lua_State *L, int stk) default: TYPEERROR("pivot frame", LUA_TNUMBER, lua_type(L, stk+1)); } - if ((idx < 0) || (idx >= 64)) - return luaL_error(L, "pivot frame %d out of range (0 - %d)", idx, 63); + if ((idx < 0) || (idx >= MAXFRAMENUM)) + return luaL_error(L, "pivot frame %d out of range (0 - %d)", idx, MAXFRAMENUM - 1); // the values in pivot[] are also tables if (PopPivotSubTable(info->pivot, L, stk+2, idx)) info->available = true; @@ -555,7 +555,7 @@ static int pivotlist_set(lua_State *L) static int pivotlist_num(lua_State *L) { - lua_pushinteger(L, 64); + lua_pushinteger(L, MAXFRAMENUM); return 1; } diff --git a/src/p_pspr.h b/src/p_pspr.h index be0d9f39e37369543ea70d74e1558ebb5ca4aa36..5fb6767633398d1e304001123dcda541599b1aba 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -35,7 +35,7 @@ #pragma interface #endif -/// \brief Frame flags: only the frame number - 0 to 256 (Frames from 0 to 63, Sprite2 number uses 0 to 127 plus FF_SPR2SUPER) +/// \brief Frame flags: only the frame number - 0 to 256 (Frames from 0 to 255, Sprite2 number uses 0 to 127 plus FF_SPR2SUPER) #define FF_FRAMEMASK 0xff /// \brief Frame flags - SPR2: Super sprite2 diff --git a/src/r_defs.h b/src/r_defs.h index cb94dd6e5a5641970b216e88ce9183d66d186e63..da4dd2d70e6049479eacd24c51af11b4a995507b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -976,6 +976,8 @@ typedef struct #endif } spriteframe_t; +#define MAXFRAMENUM 256 + // // A sprite definition: a number of animation frames. // diff --git a/src/r_picformats.h b/src/r_picformats.h index 3ee9805d867f30cf8eec923285b24d0172038f18..098f927a5619d74ca9813d37658d5bfb75bc8f04 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -100,7 +100,7 @@ typedef struct typedef struct { - spriteframepivot_t pivot[64]; + spriteframepivot_t pivot[MAXFRAMENUM]; boolean available; } spriteinfo_t; diff --git a/src/r_things.c b/src/r_things.c index 317aa6c5604041a592ae5a24785e1bbf9715b45a..4e60e913f053d305057a0d9f585290ce63aa3bd2 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -77,7 +77,7 @@ spriteinfo_t spriteinfo[NUMSPRITES]; spritedef_t *sprites; size_t numsprites; -static spriteframe_t sprtemp[64]; +static spriteframe_t sprtemp[MAXFRAMENUM]; static size_t maxframe; static const char *spritename; @@ -248,9 +248,9 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch static boolean GetFramesAndRotationsFromShortLumpName( const char *name, - UINT8 *ret_frame, + INT32 *ret_frame, UINT8 *ret_rotation, - UINT8 *ret_frame2, + INT32 *ret_frame2, UINT8 *ret_rotation2 ) { @@ -273,7 +273,7 @@ static boolean GetFramesAndRotationsFromShortLumpName( } else { - *ret_frame2 = 255; + *ret_frame2 = -1; *ret_rotation2 = 255; } @@ -282,9 +282,9 @@ static boolean GetFramesAndRotationsFromShortLumpName( static boolean GetFramesAndRotationsFromLongLumpName( const char *name, - UINT8 *ret_frame, + INT32 *ret_frame, UINT8 *ret_rotation, - UINT8 *ret_frame2, + INT32 *ret_frame2, UINT8 *ret_rotation2 ) { @@ -305,10 +305,10 @@ static boolean GetFramesAndRotationsFromLongLumpName( *ret_frame = atoi(framepart); *ret_rotation = R_Char2Rotation(*(underscore + 1)); - if (*ret_frame >= 64 || *ret_rotation == 255) + if (*ret_frame >= MAXFRAMENUM || *ret_rotation == 255) return false; - *ret_frame2 = 255; + *ret_frame2 = -1; *ret_rotation2 = 255; return true; @@ -404,7 +404,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 { INT16 width, height; INT16 topoffset, leftoffset; - UINT8 frame, frame2; + INT32 frame, frame2; UINT8 rotation, rotation2; boolean good = longname ? @@ -443,7 +443,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 //---------------------------------------------------- R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 0); - if (frame2 != 255) + if (frame2 != -1) R_InstallSpriteLump(wadnum, l, numspritelumps, frame2, rotation2, 1); if (++numspritelumps >= max_spritelumps)