From 4016d15f7b10d0814ecf852e02485eb0ce700a8d Mon Sep 17 00:00:00 2001 From: JTE Date: Sat, 4 Apr 2015 18:38:20 -0400 Subject: [PATCH 01/30] Adjusted platform-creating velocity of goo water. Now it will only bounce ONCE when you jump on it, and Knuckles just barely gets enough velocity out of his jump for even that. This will leave players vulnerable and annoyed for a lot less time while they wait to finish bouncing. --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 2321cd969..b4f17db7a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -121,7 +121,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) /*Someone want to make these work like bumpers?*/ return; } - + object->eflags |= MFE_SPRUNG; // apply this flag asap! spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify @@ -1223,7 +1223,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { // If you're inside goowater and slowing down fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale); - fixed_t minspeed = FixedMul(thing->info->height/12, thing->scale); + fixed_t minspeed = FixedMul(thing->info->height/9, thing->scale); if (thing->z < *rover->topheight && *rover->bottomheight < thingtop && abs(thing->momz) < minspeed) { From 4f06650a1e47366a59f5b61ae0e78cf40f183bf8 Mon Sep 17 00:00:00 2001 From: JTE Date: Sat, 4 Apr 2015 18:39:32 -0400 Subject: [PATCH 02/30] Removed the small velocity boost you get for surfacing from goo. This will prevent the goo from maintaining momentum for too long, and shorten the amount of time before you stabilize on the surface. --- src/p_mobj.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 081124b95..7a7d6e702 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2526,10 +2526,8 @@ void P_MobjCheckWater(mobj_t *mobj) return; if ((mobj->eflags & MFE_GOOWATER || wasingoo)) { // Decide what happens to your momentum when you enter/leave goopy water. - if (wasinwater && P_MobjFlip(mobj)*mobj->momz > 0) - mobj->momz = FixedMul(mobj->momz, FixedDiv(9*FRACUNIT, 8*FRACUNIT)); // Give the mobj a little out-of-goo boost. - else if (P_MobjFlip(mobj)*mobj->momz < 0) - mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // KILL its momentum. + if (P_MobjFlip(mobj)*mobj->momz < 0) // You are entering the goo? + mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // kill momentum significantly, to make the goo feel thick. } else if (wasinwater && P_MobjFlip(mobj)*mobj->momz > 0) mobj->momz = FixedMul(mobj->momz, FixedDiv(780*FRACUNIT, 457*FRACUNIT)); // Give the mobj a little out-of-water boost. From ddd66b9eff15dbdc995a3798b37dd81a8b8a07f3 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 17 Apr 2015 12:10:40 -0500 Subject: [PATCH 03/30] Make A_SetObjectFlags only reset sector/bmap links if needed --- src/p_enemy.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 8b7af9318..4719a9d06 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7650,26 +7650,33 @@ void A_SetObjectFlags(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; + boolean unlinkthings = false; #ifdef HAVE_BLUA if (LUA_CallAction("A_SetObjectFlags", actor)) return; #endif - P_UnsetThingPosition(actor); - if (sector_list) - { - P_DelSeclist(sector_list); - sector_list = NULL; + if (locvar2 == 2) + locvar1 = actor->flags | locvar1; + else if (locvar2 == 1) + locvar1 = actor->flags & ~locvar1; + + if ((locvar1 & (MF_NOBLOCKMAP|MF_NOSECTOR)) != (actor->flags & (MF_NOBLOCKMAP|MF_NOSECTOR))) // Blockmap/sector status has changed, so reset the links + unlinkthings = true; + + if (unlinkthings) { + P_UnsetThingPosition(actor); + if (sector_list) + { + P_DelSeclist(sector_list); + sector_list = NULL; + } } - if (locvar2 == 2) - actor->flags |= locvar1; - else if (locvar2 == 1) - actor->flags &= ~locvar1; - else - actor->flags = locvar1; + actor->flags = locvar1; - P_SetThingPosition(actor); + if (unlinkthings) + P_SetThingPosition(actor); } // Function: A_SetObjectFlags2 From 1e62be15ce97a59802019b9000ec412162f0f78a Mon Sep 17 00:00:00 2001 From: JTE Date: Wed, 20 May 2015 17:29:32 -0400 Subject: [PATCH 04/30] ALL7EMERALDS is a boolean you idiot, not an integer. --- src/lua_mathlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index f8b33ffd2..b01561574 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -156,7 +156,7 @@ static int lib_getsecspecial(lua_State *L) static int lib_all7emeralds(lua_State *L) { - lua_pushinteger(L, ALL7EMERALDS(luaL_checkinteger(L, 1))); + lua_pushboolean(L, ALL7EMERALDS(luaL_checkinteger(L, 1))); return 1; } From 9d36cf37bd6fc1e5e0e9770031925db3a92a9929 Mon Sep 17 00:00:00 2001 From: JTE Date: Wed, 20 May 2015 18:44:03 -0400 Subject: [PATCH 05/30] Removed EvalMath from base Lua. EvalMath is for SOC only. It spawns an entirely seperate instance of Lua and requires uppercase-only strings, and it's ability to parse strings to enums is redundant to Lua's _G table (try using _G["MT_BLUECRAWLA"] for instance) --- src/lua_baselib.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index ad5d740f8..70c6bf47f 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -85,13 +85,6 @@ static int lib_print(lua_State *L) return 0; } -static int lib_evalMath(lua_State *L) -{ - const char *word = luaL_checkstring(L, 1); - lua_pushinteger(L, LUA_EvalMath(word)); - return 1; -} - // M_RANDOM ////////////// @@ -1861,7 +1854,6 @@ static int lib_gTicsToMilliseconds(lua_State *L) static luaL_Reg lib[] = { {"print", lib_print}, - {"EvalMath", lib_evalMath}, // m_random {"P_Random",lib_pRandom}, From ef0e61fc3357fc8fb5367b522dd738edc96b2a7a Mon Sep 17 00:00:00 2001 From: JTE Date: Wed, 20 May 2015 23:54:04 -0400 Subject: [PATCH 06/30] Change LUA_NUMBER to fixed_t, change angle_t handling in Lua. Angles now go from 0 to 0xFFFF (360 degrees == FRACUNIT) instead of using a full UINT32. Lua only has one number type, so signedness gets in the way of using angle_t directly. This handling of angles matches up with how ZDoom ACS scripting and the like does it. I also changed all the integer casts and pushes of fixed_t to their own macro in preperation for possible future seperation. --- src/blua/luaconf.h | 17 ++--- src/dehacked.c | 60 ++++++++-------- src/lua_baselib.c | 164 ++++++++++++++++++++++---------------------- src/lua_infolib.c | 18 ++--- src/lua_maplib.c | 30 ++++---- src/lua_mathlib.c | 32 ++++----- src/lua_mobjlib.c | 68 +++++++++--------- src/lua_playerlib.c | 82 +++++++++++----------- src/lua_script.c | 13 +--- src/lua_script.h | 12 ++++ src/lua_skinlib.c | 12 ++-- 11 files changed, 256 insertions(+), 252 deletions(-) diff --git a/src/blua/luaconf.h b/src/blua/luaconf.h index 4fb940799..4a8a41723 100644 --- a/src/blua/luaconf.h +++ b/src/blua/luaconf.h @@ -10,6 +10,7 @@ #include #include +#include /* @@ -140,7 +141,7 @@ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ -#define LUA_INTEGER ptrdiff_t +#define LUA_INTEGER int32_t /* @@ -502,13 +503,13 @@ */ //#define LUA_NUMBER_DOUBLE -#define LUA_NUMBER ptrdiff_t +#define LUA_NUMBER int32_t /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ -#define LUAI_UACNUMBER ptrdiff_t +#define LUAI_UACNUMBER int32_t /* @@ -519,14 +520,14 @@ @@ lua_str2number converts a string to a number. */ #ifdef LUA_WIN - #define LUA_NUMBER_SCAN "%Ii" - #define LUA_NUMBER_FMT "%Ii" + #define LUA_NUMBER_SCAN "%d" + #define LUA_NUMBER_FMT "%d" #else - #define LUA_NUMBER_SCAN "%ti" - #define LUA_NUMBER_FMT "%ti" + #define LUA_NUMBER_SCAN "%d" + #define LUA_NUMBER_FMT "%d" #endif #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) -#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define LUAI_MAXNUMBER2STR 12 /* 10 digits, sign, and \0 */ #define lua_str2number(s,p) strtol((s), (p), 10) diff --git a/src/dehacked.c b/src/dehacked.c index 513079e6e..26082ee88 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7753,36 +7753,36 @@ struct { {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. // Angles - {"ANG1",ANG1}, - {"ANG2",ANG2}, - {"ANG10",ANG10}, - {"ANG15",ANG15}, - {"ANG20",ANG20}, - {"ANG30",ANG30}, - {"ANG60",ANG60}, - {"ANG64h",ANG64h}, - {"ANG105",ANG105}, - {"ANG210",ANG210}, - {"ANG255",ANG255}, - {"ANG340",ANG340}, - {"ANG350",ANG350}, - {"ANGLE_11hh",ANGLE_11hh}, - {"ANGLE_22h",ANGLE_22h}, - {"ANGLE_45",ANGLE_45}, - {"ANGLE_67h",ANGLE_67h}, - {"ANGLE_90",ANGLE_90}, - {"ANGLE_112h",ANGLE_112h}, - {"ANGLE_135",ANGLE_135}, - {"ANGLE_157h",ANGLE_157h}, - {"ANGLE_180",ANGLE_180}, - {"ANGLE_202h",ANGLE_202h}, - {"ANGLE_225",ANGLE_225}, - {"ANGLE_247h",ANGLE_247h}, - {"ANGLE_270",ANGLE_270}, - {"ANGLE_292h",ANGLE_292h}, - {"ANGLE_315",ANGLE_315}, - {"ANGLE_337h",ANGLE_337h}, - {"ANGLE_MAX",ANGLE_MAX}, + {"ANG1",ANG1>>16}, + {"ANG2",ANG2>>16}, + {"ANG10",ANG10>>16}, + {"ANG15",ANG15>>16}, + {"ANG20",ANG20>>16}, + {"ANG30",ANG30>>16}, + {"ANG60",ANG60>>16}, + {"ANG64h",ANG64h>>16}, + {"ANG105",ANG105>>16}, + {"ANG210",ANG210>>16}, + {"ANG255",ANG255>>16}, + {"ANG340",ANG340>>16}, + {"ANG350",ANG350>>16}, + {"ANGLE_11hh",ANGLE_11hh>>16}, + {"ANGLE_22h",ANGLE_22h>>16}, + {"ANGLE_45",ANGLE_45>>16}, + {"ANGLE_67h",ANGLE_67h>>16}, + {"ANGLE_90",ANGLE_90>>16}, + {"ANGLE_112h",ANGLE_112h>>16}, + {"ANGLE_135",ANGLE_135>>16}, + {"ANGLE_157h",ANGLE_157h>>16}, + {"ANGLE_180",ANGLE_180>>16}, + {"ANGLE_202h",ANGLE_202h>>16}, + {"ANGLE_225",ANGLE_225>>16}, + {"ANGLE_247h",ANGLE_247h>>16}, + {"ANGLE_270",ANGLE_270>>16}, + {"ANGLE_292h",ANGLE_292h>>16}, + {"ANGLE_315",ANGLE_315>>16}, + {"ANGLE_337h",ANGLE_337h>>16}, + {"ANGLE_MAX",ANGLE_MAX>>16}, // P_Chase directions (dirtype_t) {"DI_NODIR",DI_NODIR}, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 70c6bf47f..d76839e73 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -131,25 +131,25 @@ static int lib_pRandomRange(lua_State *L) static int lib_pAproxDistance(lua_State *L) { - fixed_t dx = (fixed_t)luaL_checkinteger(L, 1); - fixed_t dy = (fixed_t)luaL_checkinteger(L, 2); + fixed_t dx = luaL_checkfixed(L, 1); + fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushinteger(L, P_AproxDistance(dx, dy)); + lua_pushfixed(L, P_AproxDistance(dx, dy)); return 1; } static int lib_pClosestPointOnLine(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); vertex_t result; //HUDSAFE if (!line) return LUA_ErrInvalid(L, "line_t"); P_ClosestPointOnLine(x, y, line, &result); - lua_pushinteger(L, result.x); - lua_pushinteger(L, result.y); + lua_pushfixed(L, result.x); + lua_pushfixed(L, result.y); return 2; } @@ -234,9 +234,9 @@ static int lib_pLookForPlayers(lua_State *L) static int lib_pSpawnMobj(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); - fixed_t z = (fixed_t)luaL_checkinteger(L, 3); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); + fixed_t z = luaL_checkfixed(L, 3); mobjtype_t type = luaL_checkinteger(L, 4); NOHUD if (type > MT_LASTFREESLOT) @@ -276,9 +276,9 @@ static int lib_pSpawnXYZMissile(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobjtype_t type = luaL_checkinteger(L, 3); - fixed_t x = (fixed_t)luaL_checkinteger(L, 4); - fixed_t y = (fixed_t)luaL_checkinteger(L, 5); - fixed_t z = (fixed_t)luaL_checkinteger(L, 6); + fixed_t x = luaL_checkfixed(L, 4); + fixed_t y = luaL_checkfixed(L, 5); + fixed_t z = luaL_checkfixed(L, 6); NOHUD if (!source || !dest) return LUA_ErrInvalid(L, "mobj_t"); @@ -291,13 +291,13 @@ static int lib_pSpawnXYZMissile(lua_State *L) static int lib_pSpawnPointMissile(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t xa = (fixed_t)luaL_checkinteger(L, 2); - fixed_t ya = (fixed_t)luaL_checkinteger(L, 3); - fixed_t za = (fixed_t)luaL_checkinteger(L, 4); + fixed_t xa = luaL_checkfixed(L, 2); + fixed_t ya = luaL_checkfixed(L, 3); + fixed_t za = luaL_checkfixed(L, 4); mobjtype_t type = luaL_checkinteger(L, 5); - fixed_t x = (fixed_t)luaL_checkinteger(L, 6); - fixed_t y = (fixed_t)luaL_checkinteger(L, 7); - fixed_t z = (fixed_t)luaL_checkinteger(L, 8); + fixed_t x = luaL_checkfixed(L, 6); + fixed_t y = luaL_checkfixed(L, 7); + fixed_t z = luaL_checkfixed(L, 8); NOHUD if (!source) return LUA_ErrInvalid(L, "mobj_t"); @@ -311,9 +311,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobjtype_t type = luaL_checkinteger(L, 2); - fixed_t x = (fixed_t)luaL_checkinteger(L, 3); - fixed_t y = (fixed_t)luaL_checkinteger(L, 4); - fixed_t z = (fixed_t)luaL_checkinteger(L, 5); + fixed_t x = luaL_checkfixed(L, 3); + fixed_t y = luaL_checkfixed(L, 4); + fixed_t z = luaL_checkfixed(L, 5); INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5); NOHUD if (!source) @@ -341,7 +341,7 @@ static int lib_pSPMAngle(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobjtype_t type = luaL_checkinteger(L, 2); - angle_t angle = (angle_t)luaL_checkinteger(L, 3); + angle_t angle = luaL_checkangle(L, 3); UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0); UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0); NOHUD @@ -411,13 +411,13 @@ static int lib_pGetClosestAxis(lua_State *L) static int lib_pSpawnParaloop(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); - fixed_t z = (fixed_t)luaL_checkinteger(L, 3); - fixed_t radius = (fixed_t)luaL_checkinteger(L, 4); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); + fixed_t z = luaL_checkfixed(L, 3); + fixed_t radius = luaL_checkfixed(L, 4); INT32 number = (INT32)luaL_checkinteger(L, 5); mobjtype_t type = luaL_checkinteger(L, 6); - angle_t rotangle = (angle_t)luaL_checkinteger(L, 7); + angle_t rotangle = luaL_checkangle(L, 7); statenum_t nstate = luaL_optinteger(L, 8, S_NULL); boolean spawncenter = lua_optboolean(L, 9); NOHUD @@ -451,7 +451,7 @@ static int lib_pSupermanLook4Players(lua_State *L) static int lib_pSetScale(lua_State *L) { mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t newscale = (fixed_t)luaL_checkinteger(L, 2); + fixed_t newscale = luaL_checkfixed(L, 2); NOHUD if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); @@ -519,7 +519,7 @@ static int lib_pGetPlayerHeight(lua_State *L) //HUDSAFE if (!player) return LUA_ErrInvalid(L, "player_t"); - lua_pushinteger(L, P_GetPlayerHeight(player)); + lua_pushfixed(L, P_GetPlayerHeight(player)); return 1; } @@ -529,7 +529,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L) //HUDSAFE if (!player) return LUA_ErrInvalid(L, "player_t"); - lua_pushinteger(L, P_GetPlayerSpinHeight(player)); + lua_pushfixed(L, P_GetPlayerSpinHeight(player)); return 1; } @@ -632,7 +632,7 @@ static int lib_pInQuicksand(lua_State *L) static int lib_pSetObjectMomZ(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t value = (fixed_t)luaL_checkinteger(L, 2); + fixed_t value = luaL_checkfixed(L, 2); boolean relative = lua_optboolean(L, 3); NOHUD if (!mo) @@ -746,8 +746,8 @@ static int lib_pDoPlayerExit(lua_State *L) static int lib_pInstaThrust(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - angle_t angle = (angle_t)luaL_checkinteger(L, 2); - fixed_t move = (fixed_t)luaL_checkinteger(L, 3); + angle_t angle = luaL_checkangle(L, 2); + fixed_t move = luaL_checkfixed(L, 3); NOHUD if (!mo) return LUA_ErrInvalid(L, "mobj_t"); @@ -761,10 +761,10 @@ static int lib_pReturnThrustX(lua_State *L) fixed_t move; if (lua_isnil(L, 1) || lua_isuserdata(L, 1)) lua_remove(L, 1); // ignore mobj as arg1 - angle = (angle_t)luaL_checkinteger(L, 1); - move = (fixed_t)luaL_checkinteger(L, 2); + angle = luaL_checkangle(L, 1); + move = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushinteger(L, P_ReturnThrustX(NULL, angle, move)); + lua_pushfixed(L, P_ReturnThrustX(NULL, angle, move)); return 1; } @@ -774,10 +774,10 @@ static int lib_pReturnThrustY(lua_State *L) fixed_t move; if (lua_isnil(L, 1) || lua_isuserdata(L, 1)) lua_remove(L, 1); // ignore mobj as arg1 - angle = (angle_t)luaL_checkinteger(L, 1); - move = (fixed_t)luaL_checkinteger(L, 2); + angle = luaL_checkangle(L, 1); + move = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushinteger(L, P_ReturnThrustY(NULL, angle, move)); + lua_pushfixed(L, P_ReturnThrustY(NULL, angle, move)); return 1; } @@ -795,7 +795,7 @@ static int lib_pNukeEnemies(lua_State *L) { mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - fixed_t radius = (fixed_t)luaL_checkinteger(L, 3); + fixed_t radius = luaL_checkfixed(L, 3); NOHUD if (!inflictor || !source) return LUA_ErrInvalid(L, "mobj_t"); @@ -861,8 +861,8 @@ static int lib_pSpawnSpinMobj(lua_State *L) static int lib_pTelekinesis(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2); - fixed_t range = (fixed_t)luaL_checkinteger(L, 3); + fixed_t thrust = luaL_checkfixed(L, 2); + fixed_t range = luaL_checkfixed(L, 3); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); @@ -877,8 +877,8 @@ static int lib_pCheckPosition(lua_State *L) { mobj_t *ptmthing = tmthing; mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t x = (fixed_t)luaL_checkinteger(L, 2); - fixed_t y = (fixed_t)luaL_checkinteger(L, 3); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); NOHUD if (!thing) return LUA_ErrInvalid(L, "mobj_t"); @@ -892,8 +892,8 @@ static int lib_pTryMove(lua_State *L) { mobj_t *ptmthing = tmthing; mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t x = (fixed_t)luaL_checkinteger(L, 2); - fixed_t y = (fixed_t)luaL_checkinteger(L, 3); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); boolean allowdropoff = lua_optboolean(L, 4); NOHUD if (!thing) @@ -908,7 +908,7 @@ static int lib_pMove(lua_State *L) { mobj_t *ptmthing = tmthing; mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t speed = (fixed_t)luaL_checkinteger(L, 2); + fixed_t speed = luaL_checkfixed(L, 2); NOHUD if (!actor) return LUA_ErrInvalid(L, "mobj_t"); @@ -922,9 +922,9 @@ static int lib_pTeleportMove(lua_State *L) { mobj_t *ptmthing = tmthing; mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t x = (fixed_t)luaL_checkinteger(L, 2); - fixed_t y = (fixed_t)luaL_checkinteger(L, 3); - fixed_t z = (fixed_t)luaL_checkinteger(L, 4); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); + fixed_t z = luaL_checkfixed(L, 4); NOHUD if (!thing) return LUA_ErrInvalid(L, "mobj_t"); @@ -968,10 +968,10 @@ static int lib_pCheckSight(lua_State *L) static int lib_pCheckHoopPosition(lua_State *L) { mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - fixed_t x = (fixed_t)luaL_checkinteger(L, 2); - fixed_t y = (fixed_t)luaL_checkinteger(L, 3); - fixed_t z = (fixed_t)luaL_checkinteger(L, 4); - fixed_t radius = (fixed_t)luaL_checkinteger(L, 5); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); + fixed_t z = luaL_checkfixed(L, 4); + fixed_t radius = luaL_checkfixed(L, 5); NOHUD if (!hoopthing) return LUA_ErrInvalid(L, "mobj_t"); @@ -983,7 +983,7 @@ static int lib_pRadiusAttack(lua_State *L) { mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - fixed_t damagedist = (fixed_t)luaL_checkinteger(L, 3); + fixed_t damagedist = luaL_checkfixed(L, 3); NOHUD if (!spot || !source) return LUA_ErrInvalid(L, "mobj_t"); @@ -993,12 +993,12 @@ static int lib_pRadiusAttack(lua_State *L) static int lib_pFloorzAtPos(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); - fixed_t z = (fixed_t)luaL_checkinteger(L, 3); - fixed_t height = (fixed_t)luaL_checkinteger(L, 4); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); + fixed_t z = luaL_checkfixed(L, 3); + fixed_t height = luaL_checkfixed(L, 4); //HUDSAFE - lua_pushinteger(L, P_FloorzAtPos(x, y, z, height)); + lua_pushfixed(L, P_FloorzAtPos(x, y, z, height)); return 1; } @@ -1202,8 +1202,8 @@ static int lib_pDoNightsScore(lua_State *L) static int lib_pThrust(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - angle_t angle = (angle_t)luaL_checkinteger(L, 2); - fixed_t move = (fixed_t)luaL_checkinteger(L, 3); + angle_t angle = luaL_checkangle(L, 2); + fixed_t move = luaL_checkfixed(L, 3); NOHUD if (!mo) return LUA_ErrInvalid(L, "mobj_t"); @@ -1478,48 +1478,48 @@ static int lib_evCrumbleChain(lua_State *L) static int lib_rPointToAngle(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushinteger(L, R_PointToAngle(x, y)); + lua_pushangle(L, R_PointToAngle(x, y)); return 1; } static int lib_rPointToAngle2(lua_State *L) { - fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1); - fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2); - fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3); - fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4); + fixed_t px2 = luaL_checkfixed(L, 1); + fixed_t py2 = luaL_checkfixed(L, 2); + fixed_t px1 = luaL_checkfixed(L, 3); + fixed_t py1 = luaL_checkfixed(L, 4); //HUDSAFE - lua_pushinteger(L, R_PointToAngle2(px2, py2, px1, py1)); + lua_pushangle(L, R_PointToAngle2(px2, py2, px1, py1)); return 1; } static int lib_rPointToDist(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushinteger(L, R_PointToDist(x, y)); + lua_pushfixed(L, R_PointToDist(x, y)); return 1; } static int lib_rPointToDist2(lua_State *L) { - fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1); - fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2); - fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3); - fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4); + fixed_t px2 = luaL_checkfixed(L, 1); + fixed_t py2 = luaL_checkfixed(L, 2); + fixed_t px1 = luaL_checkfixed(L, 3); + fixed_t py1 = luaL_checkfixed(L, 4); //HUDSAFE - lua_pushinteger(L, R_PointToDist2(px2, py2, px1, py1)); + lua_pushfixed(L, R_PointToDist2(px2, py2, px1, py1)); return 1; } static int lib_rPointInSubsector(lua_State *L) { - fixed_t x = (fixed_t)luaL_checkinteger(L, 1); - fixed_t y = (fixed_t)luaL_checkinteger(L, 2); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); //HUDSAFE LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR); return 1; @@ -1653,7 +1653,7 @@ static int lib_sChangeMusic(lua_State *L) static int lib_sSpeedMusic(lua_State *L) { - fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1); + fixed_t fixedspeed = luaL_checkfixed(L, 1); float speed = FIXED_TO_FLOAT(fixedspeed); player_t *player = NULL; NOHUD diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 2c968218c..2dc14d6fc 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -510,11 +510,11 @@ static int lib_setMobjInfo(lua_State *L) else if (i == 15 || (str && fastcmp(str,"deathsound"))) info->deathsound = luaL_checkinteger(L, 3); else if (i == 16 || (str && fastcmp(str,"speed"))) - info->speed = (fixed_t)luaL_checkinteger(L, 3); + info->speed = luaL_checkfixed(L, 3); else if (i == 17 || (str && fastcmp(str,"radius"))) - info->radius = (fixed_t)luaL_checkinteger(L, 3); + info->radius = luaL_checkfixed(L, 3); else if (i == 18 || (str && fastcmp(str,"height"))) - info->height = (fixed_t)luaL_checkinteger(L, 3); + info->height = luaL_checkfixed(L, 3); else if (i == 19 || (str && fastcmp(str,"dispoffset"))) info->dispoffset = (INT32)luaL_checkinteger(L, 3); else if (i == 20 || (str && fastcmp(str,"mass"))) @@ -580,11 +580,11 @@ static int mobjinfo_get(lua_State *L) else if (fastcmp(field,"deathsound")) lua_pushinteger(L, info->deathsound); else if (fastcmp(field,"speed")) - lua_pushinteger(L, info->speed); + lua_pushinteger(L, info->speed); // sometimes it's fixed_t, sometimes it's not... else if (fastcmp(field,"radius")) - lua_pushinteger(L, info->radius); + lua_pushfixed(L, info->radius); else if (fastcmp(field,"height")) - lua_pushinteger(L, info->height); + lua_pushfixed(L, info->height); else if (fastcmp(field,"dispoffset")) lua_pushinteger(L, info->dispoffset); else if (fastcmp(field,"mass")) @@ -656,11 +656,11 @@ static int mobjinfo_set(lua_State *L) else if (fastcmp(field,"deathsound")) info->deathsound = luaL_checkinteger(L, 3); else if (fastcmp(field,"speed")) - info->speed = (fixed_t)luaL_checkinteger(L, 3); + info->speed = luaL_checkfixed(L, 3); else if (fastcmp(field,"radius")) - info->radius = (fixed_t)luaL_checkinteger(L, 3); + info->radius = luaL_checkfixed(L, 3); else if (fastcmp(field,"height")) - info->height = (fixed_t)luaL_checkinteger(L, 3); + info->height = luaL_checkfixed(L, 3); else if (fastcmp(field,"dispoffset")) info->dispoffset = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"mass")) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index e5cc30c12..82bd78f73 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -280,10 +280,10 @@ static int sector_get(lua_State *L) lua_pushboolean(L, 1); return 1; case sector_floorheight: - lua_pushinteger(L, sector->floorheight); + lua_pushfixed(L, sector->floorheight); return 1; case sector_ceilingheight: - lua_pushinteger(L, sector->ceilingheight); + lua_pushfixed(L, sector->ceilingheight); return 1; case sector_floorpic: { // floorpic levelflat_t *levelflat; @@ -397,7 +397,7 @@ static int sector_set(lua_State *L) case sector_floorheight: { // floorheight boolean flag; fixed_t lastpos = sector->floorheight; - sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); + sector->floorheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); if (flag && sector->numattached) { @@ -409,7 +409,7 @@ static int sector_set(lua_State *L) case sector_ceilingheight: { // ceilingheight boolean flag; fixed_t lastpos = sector->ceilingheight; - sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); + sector->ceilingheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); if (flag && sector->numattached) { @@ -509,10 +509,10 @@ static int line_get(lua_State *L) LUA_PushUserdata(L, line->v2, META_VERTEX); return 1; case line_dx: - lua_pushinteger(L, line->dx); + lua_pushfixed(L, line->dx); return 1; case line_dy: - lua_pushinteger(L, line->dy); + lua_pushfixed(L, line->dy); return 1; case line_flags: lua_pushinteger(L, line->flags); @@ -628,10 +628,10 @@ static int side_get(lua_State *L) lua_pushboolean(L, 1); return 1; case side_textureoffset: - lua_pushinteger(L, side->textureoffset); + lua_pushfixed(L, side->textureoffset); return 1; case side_rowoffset: - lua_pushinteger(L, side->rowoffset); + lua_pushfixed(L, side->rowoffset); return 1; case side_toptexture: lua_pushinteger(L, side->toptexture); @@ -685,13 +685,13 @@ static int vertex_get(lua_State *L) lua_pushboolean(L, 1); return 1; case vertex_x: - lua_pushinteger(L, vertex->x); + lua_pushfixed(L, vertex->x); return 1; case vertex_y: - lua_pushinteger(L, vertex->y); + lua_pushfixed(L, vertex->y); return 1; case vertex_z: - lua_pushinteger(L, vertex->z); + lua_pushfixed(L, vertex->z); return 1; } return 0; @@ -954,7 +954,7 @@ static int ffloor_get(lua_State *L) lua_pushboolean(L, 1); return 1; case ffloor_topheight: - lua_pushinteger(L, *ffloor->topheight); + lua_pushfixed(L, *ffloor->topheight); return 1; case ffloor_toppic: { // toppic levelflat_t *levelflat; @@ -968,7 +968,7 @@ static int ffloor_get(lua_State *L) lua_pushinteger(L, *ffloor->toplightlevel); return 1; case ffloor_bottomheight: - lua_pushinteger(L, *ffloor->bottomheight); + lua_pushfixed(L, *ffloor->bottomheight); return 1; case ffloor_bottompic: { // bottompic levelflat_t *levelflat; @@ -1028,7 +1028,7 @@ static int ffloor_set(lua_State *L) boolean flag; fixed_t lastpos = *ffloor->topheight; sector_t *sector = §ors[ffloor->secnum]; - sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); + sector->ceilingheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); if (flag && sector->numattached) { @@ -1047,7 +1047,7 @@ static int ffloor_set(lua_State *L) boolean flag; fixed_t lastpos = *ffloor->bottomheight; sector_t *sector = §ors[ffloor->secnum]; - sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); + sector->floorheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); if (flag && sector->numattached) { diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index b01561574..8ca2e17af 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -47,37 +47,37 @@ static int lib_max(lua_State *L) static int lib_fixedangle(lua_State *L) { - lua_pushinteger(L, FixedAngle((fixed_t)luaL_checkinteger(L, 1))); + lua_pushangle(L, FixedAngle(luaL_checkfixed(L, 1))); return 1; } static int lib_anglefixed(lua_State *L) { - lua_pushinteger(L, AngleFixed((angle_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, AngleFixed(luaL_checkangle(L, 1))); return 1; } static int lib_invangle(lua_State *L) { - lua_pushinteger(L, InvAngle((angle_t)luaL_checkinteger(L, 1))); + lua_pushangle(L, InvAngle(luaL_checkangle(L, 1))); return 1; } static int lib_finesine(lua_State *L) { - lua_pushinteger(L, FINESINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); + lua_pushfixed(L, FINESINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); return 1; } static int lib_finecosine(lua_State *L) { - lua_pushinteger(L, FINECOSINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); + lua_pushfixed(L, FINECOSINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); return 1; } static int lib_finetangent(lua_State *L) { - lua_pushinteger(L, FINETANGENT((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); + lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); return 1; } @@ -86,61 +86,61 @@ static int lib_finetangent(lua_State *L) static int lib_fixedmul(lua_State *L) { - lua_pushinteger(L, FixedMul((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); + lua_pushfixed(L, FixedMul(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; } static int lib_fixedint(lua_State *L) { - lua_pushinteger(L, FixedInt((fixed_t)luaL_checkinteger(L, 1))); + lua_pushinteger(L, FixedInt(luaL_checkfixed(L, 1))); return 1; } static int lib_fixeddiv(lua_State *L) { - lua_pushinteger(L, FixedDiv((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); + lua_pushfixed(L, FixedDiv(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; } static int lib_fixedrem(lua_State *L) { - lua_pushinteger(L, FixedRem((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); + lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; } static int lib_fixedsqrt(lua_State *L) { - lua_pushinteger(L, FixedSqrt((fixed_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, FixedSqrt(luaL_checkfixed(L, 1))); return 1; } static int lib_fixedhypot(lua_State *L) { - lua_pushinteger(L, FixedHypot((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); + lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; } static int lib_fixedfloor(lua_State *L) { - lua_pushinteger(L, FixedFloor((fixed_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, FixedFloor(luaL_checkfixed(L, 1))); return 1; } static int lib_fixedtrunc(lua_State *L) { - lua_pushinteger(L, FixedTrunc((fixed_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, FixedTrunc(luaL_checkfixed(L, 1))); return 1; } static int lib_fixedceil(lua_State *L) { - lua_pushinteger(L, FixedCeil((fixed_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, FixedCeil(luaL_checkfixed(L, 1))); return 1; } static int lib_fixedround(lua_State *L) { - lua_pushinteger(L, FixedRound((fixed_t)luaL_checkinteger(L, 1))); + lua_pushfixed(L, FixedRound(luaL_checkfixed(L, 1))); return 1; } diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index cf4db8f39..417431d4f 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -162,13 +162,13 @@ static int mobj_get(lua_State *L) lua_pushboolean(L, 1); break; case mobj_x: - lua_pushinteger(L, mo->x); + lua_pushfixed(L, mo->x); break; case mobj_y: - lua_pushinteger(L, mo->y); + lua_pushfixed(L, mo->y); break; case mobj_z: - lua_pushinteger(L, mo->z); + lua_pushfixed(L, mo->z); break; case mobj_snext: LUA_PushUserdata(L, mo->snext, META_MOBJ); @@ -179,7 +179,7 @@ static int mobj_get(lua_State *L) // i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included. return UNIMPLEMENTED; case mobj_angle: - lua_pushinteger(L, mo->angle); + lua_pushangle(L, mo->angle); break; case mobj_sprite: lua_pushinteger(L, mo->sprite); @@ -193,28 +193,28 @@ static int mobj_get(lua_State *L) LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR); break; case mobj_floorz: - lua_pushinteger(L, mo->floorz); + lua_pushfixed(L, mo->floorz); break; case mobj_ceilingz: - lua_pushinteger(L, mo->ceilingz); + lua_pushfixed(L, mo->ceilingz); break; case mobj_radius: - lua_pushinteger(L, mo->radius); + lua_pushfixed(L, mo->radius); break; case mobj_height: - lua_pushinteger(L, mo->height); + lua_pushfixed(L, mo->height); break; case mobj_momx: - lua_pushinteger(L, mo->momx); + lua_pushfixed(L, mo->momx); break; case mobj_momy: - lua_pushinteger(L, mo->momy); + lua_pushfixed(L, mo->momy); break; case mobj_momz: - lua_pushinteger(L, mo->momz); + lua_pushfixed(L, mo->momz); break; case mobj_pmomz: - lua_pushinteger(L, mo->pmomz); + lua_pushfixed(L, mo->pmomz); break; case mobj_tics: lua_pushinteger(L, mo->tics); @@ -299,32 +299,32 @@ static int mobj_get(lua_State *L) LUA_PushUserdata(L, mo->tracer, META_MOBJ); break; case mobj_friction: - lua_pushinteger(L, mo->friction); + lua_pushfixed(L, mo->friction); break; case mobj_movefactor: - lua_pushinteger(L, mo->movefactor); + lua_pushfixed(L, mo->movefactor); break; case mobj_fuse: lua_pushinteger(L, mo->fuse); break; case mobj_watertop: - lua_pushinteger(L, mo->watertop); + lua_pushfixed(L, mo->watertop); break; case mobj_waterbottom: - lua_pushinteger(L, mo->waterbottom); + lua_pushfixed(L, mo->waterbottom); break; case mobj_mobjnum: // mobjnum is a networking thing generated for $$$.sav // and therefore shouldn't be used by Lua. return UNIMPLEMENTED; case mobj_scale: - lua_pushinteger(L, mo->scale); + lua_pushfixed(L, mo->scale); break; case mobj_destscale: - lua_pushinteger(L, mo->destscale); + lua_pushfixed(L, mo->destscale); break; case mobj_scalespeed: - lua_pushinteger(L, mo->scalespeed); + lua_pushfixed(L, mo->scalespeed); break; case mobj_extravalue1: lua_pushinteger(L, mo->extravalue1); @@ -382,7 +382,7 @@ static int mobj_set(lua_State *L) { // z doesn't cross sector bounds so it's okay. mobj_t *ptmthing = tmthing; - mo->z = (fixed_t)luaL_checkinteger(L, 3); + mo->z = luaL_checkfixed(L, 3); P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; @@ -394,7 +394,7 @@ static int mobj_set(lua_State *L) case mobj_sprev: return UNIMPLEMENTED; case mobj_angle: - mo->angle = (angle_t)luaL_checkinteger(L, 3); + mo->angle = luaL_checkangle(L, 3); if (mo->player == &players[consoleplayer]) localangle = mo->angle; else if (mo->player == &players[secondarydisplayplayer]) @@ -417,7 +417,7 @@ static int mobj_set(lua_State *L) case mobj_radius: { mobj_t *ptmthing = tmthing; - mo->radius = (fixed_t)luaL_checkinteger(L, 3); + mo->radius = luaL_checkfixed(L, 3); if (mo->radius < 0) mo->radius = 0; P_CheckPosition(mo, mo->x, mo->y); @@ -429,7 +429,7 @@ static int mobj_set(lua_State *L) case mobj_height: { mobj_t *ptmthing = tmthing; - mo->height = (fixed_t)luaL_checkinteger(L, 3); + mo->height = luaL_checkfixed(L, 3); if (mo->height < 0) mo->height = 0; P_CheckPosition(mo, mo->x, mo->y); @@ -439,16 +439,16 @@ static int mobj_set(lua_State *L) break; } case mobj_momx: - mo->momx = (fixed_t)luaL_checkinteger(L, 3); + mo->momx = luaL_checkfixed(L, 3); break; case mobj_momy: - mo->momy = (fixed_t)luaL_checkinteger(L, 3); + mo->momy = luaL_checkfixed(L, 3); break; case mobj_momz: - mo->momz = (fixed_t)luaL_checkinteger(L, 3); + mo->momz = luaL_checkfixed(L, 3); break; case mobj_pmomz: - mo->pmomz = (fixed_t)luaL_checkinteger(L, 3); + mo->pmomz = luaL_checkfixed(L, 3); break; case mobj_tics: mo->tics = luaL_checkinteger(L, 3); @@ -572,25 +572,25 @@ static int mobj_set(lua_State *L) } break; case mobj_friction: - mo->friction = (fixed_t)luaL_checkinteger(L, 3); + mo->friction = luaL_checkfixed(L, 3); break; case mobj_movefactor: - mo->movefactor = (fixed_t)luaL_checkinteger(L, 3); + mo->movefactor = luaL_checkfixed(L, 3); break; case mobj_fuse: mo->fuse = luaL_checkinteger(L, 3); break; case mobj_watertop: - mo->watertop = (fixed_t)luaL_checkinteger(L, 3); + mo->watertop = luaL_checkfixed(L, 3); break; case mobj_waterbottom: - mo->waterbottom = (fixed_t)luaL_checkinteger(L, 3); + mo->waterbottom = luaL_checkfixed(L, 3); break; case mobj_mobjnum: return UNIMPLEMENTED; case mobj_scale: { - fixed_t scale = (fixed_t)luaL_checkinteger(L, 3); + fixed_t scale = luaL_checkfixed(L, 3); if (scale < FRACUNIT/100) scale = FRACUNIT/100; mo->destscale = scale; @@ -599,14 +599,14 @@ static int mobj_set(lua_State *L) } case mobj_destscale: { - fixed_t scale = (fixed_t)luaL_checkinteger(L, 3); + fixed_t scale = luaL_checkfixed(L, 3); if (scale < FRACUNIT/100) scale = FRACUNIT/100; mo->destscale = scale; break; } case mobj_scalespeed: - mo->scalespeed = (fixed_t)luaL_checkinteger(L, 3); + mo->scalespeed = luaL_checkfixed(L, 3); break; case mobj_extravalue1: mo->extravalue1 = luaL_checkinteger(L, 3); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 7f64fff62..64513ab97 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -109,15 +109,15 @@ static int player_get(lua_State *L) else if (fastcmp(field,"playerstate")) lua_pushinteger(L, plr->playerstate); else if (fastcmp(field,"viewz")) - lua_pushinteger(L, plr->viewz); + lua_pushfixed(L, plr->viewz); else if (fastcmp(field,"viewheight")) - lua_pushinteger(L, plr->viewheight); + lua_pushfixed(L, plr->viewheight); else if (fastcmp(field,"deltaviewheight")) - lua_pushinteger(L, plr->deltaviewheight); + lua_pushfixed(L, plr->deltaviewheight); else if (fastcmp(field,"bob")) - lua_pushinteger(L, plr->bob); + lua_pushfixed(L, plr->bob); else if (fastcmp(field,"aiming")) - lua_pushinteger(L, plr->aiming); + lua_pushangle(L, plr->aiming); else if (fastcmp(field,"health")) lua_pushinteger(L, plr->health); else if (fastcmp(field,"pity")) @@ -141,13 +141,13 @@ static int player_get(lua_State *L) else if (fastcmp(field,"score")) lua_pushinteger(L, plr->score); else if (fastcmp(field,"dashspeed")) - lua_pushinteger(L, plr->dashspeed); + lua_pushfixed(L, plr->dashspeed); else if (fastcmp(field,"dashtime")) lua_pushinteger(L, plr->dashtime); else if (fastcmp(field,"normalspeed")) - lua_pushinteger(L, plr->normalspeed); + lua_pushfixed(L, plr->normalspeed); else if (fastcmp(field,"runspeed")) - lua_pushinteger(L, plr->runspeed); + lua_pushfixed(L, plr->runspeed); else if (fastcmp(field,"thrustfactor")) lua_pushinteger(L, plr->thrustfactor); else if (fastcmp(field,"accelstart")) @@ -167,13 +167,13 @@ static int player_get(lua_State *L) else if (fastcmp(field,"revitem")) lua_pushinteger(L, plr->revitem); else if (fastcmp(field,"actionspd")) - lua_pushinteger(L, plr->actionspd); + lua_pushfixed(L, plr->actionspd); else if (fastcmp(field,"mindash")) - lua_pushinteger(L, plr->mindash); + lua_pushfixed(L, plr->mindash); else if (fastcmp(field,"maxdash")) - lua_pushinteger(L, plr->maxdash); + lua_pushfixed(L, plr->maxdash); else if (fastcmp(field,"jumpfactor")) - lua_pushinteger(L, plr->jumpfactor); + lua_pushfixed(L, plr->jumpfactor); else if (fastcmp(field,"lives")) lua_pushinteger(L, plr->lives); else if (fastcmp(field,"continues")) @@ -183,7 +183,7 @@ static int player_get(lua_State *L) else if (fastcmp(field,"gotcontinue")) lua_pushinteger(L, plr->gotcontinue); else if (fastcmp(field,"speed")) - lua_pushinteger(L, plr->speed); + lua_pushfixed(L, plr->speed); else if (fastcmp(field,"jumping")) lua_pushboolean(L, plr->jumping); else if (fastcmp(field,"secondjump")) @@ -205,13 +205,13 @@ static int player_get(lua_State *L) else if (fastcmp(field,"skidtime")) lua_pushinteger(L, plr->skidtime); else if (fastcmp(field,"cmomx")) - lua_pushinteger(L, plr->cmomx); + lua_pushfixed(L, plr->cmomx); else if (fastcmp(field,"cmomy")) - lua_pushinteger(L, plr->cmomy); + lua_pushfixed(L, plr->cmomy); else if (fastcmp(field,"rmomx")) - lua_pushinteger(L, plr->rmomx); + lua_pushfixed(L, plr->rmomx); else if (fastcmp(field,"rmomy")) - lua_pushinteger(L, plr->rmomy); + lua_pushfixed(L, plr->rmomy); else if (fastcmp(field,"numboxes")) lua_pushinteger(L, plr->numboxes); else if (fastcmp(field,"totalring")) @@ -239,11 +239,11 @@ static int player_get(lua_State *L) else if (fastcmp(field,"starposttime")) lua_pushinteger(L, plr->starposttime); else if (fastcmp(field,"starpostangle")) - lua_pushinteger(L, plr->starpostangle); + lua_pushangle(L, plr->starpostangle); else if (fastcmp(field,"angle_pos")) - lua_pushinteger(L, plr->angle_pos); + lua_pushangle(L, plr->angle_pos); else if (fastcmp(field,"old_angle_pos")) - lua_pushinteger(L, plr->old_angle_pos); + lua_pushangle(L, plr->old_angle_pos); else if (fastcmp(field,"axis1")) LUA_PushUserdata(L, plr->axis1, META_MOBJ); else if (fastcmp(field,"axis2")) @@ -305,16 +305,16 @@ static int player_get(lua_State *L) else if (fastcmp(field,"awayviewtics")) lua_pushinteger(L, plr->awayviewtics); else if (fastcmp(field,"awayviewaiming")) - lua_pushinteger(L, plr->awayviewaiming); + lua_pushangle(L, plr->awayviewaiming); else if (fastcmp(field,"spectator")) - lua_pushinteger(L, plr->spectator); + lua_pushboolean(L, plr->spectator); else if (fastcmp(field,"bot")) lua_pushinteger(L, plr->bot); else if (fastcmp(field,"jointime")) lua_pushinteger(L, plr->jointime); #ifdef HWRENDER else if (fastcmp(field,"fovadd")) - lua_pushinteger(L, plr->fovadd); + lua_pushfixed(L, plr->fovadd); #endif else { lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); @@ -354,15 +354,15 @@ static int player_set(lua_State *L) else if (fastcmp(field,"playerstate")) plr->playerstate = luaL_checkinteger(L, 3); else if (fastcmp(field,"viewz")) - plr->viewz = (fixed_t)luaL_checkinteger(L, 3); + plr->viewz = luaL_checkfixed(L, 3); else if (fastcmp(field,"viewheight")) - plr->viewheight = (fixed_t)luaL_checkinteger(L, 3); + plr->viewheight = luaL_checkfixed(L, 3); else if (fastcmp(field,"deltaviewheight")) - plr->deltaviewheight = (fixed_t)luaL_checkinteger(L, 3); + plr->deltaviewheight = luaL_checkfixed(L, 3); else if (fastcmp(field,"bob")) - plr->bob = (fixed_t)luaL_checkinteger(L, 3); + plr->bob = luaL_checkfixed(L, 3); else if (fastcmp(field,"aiming")) { - plr->aiming = (angle_t)luaL_checkinteger(L, 3); + plr->aiming = luaL_checkangle(L, 3); if (plr == &players[consoleplayer]) localaiming = plr->aiming; else if (plr == &players[secondarydisplayplayer]) @@ -391,13 +391,13 @@ static int player_set(lua_State *L) else if (fastcmp(field,"score")) plr->score = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"dashspeed")) - plr->dashspeed = (fixed_t)luaL_checkinteger(L, 3); + plr->dashspeed = luaL_checkfixed(L, 3); else if (fastcmp(field,"dashtime")) plr->dashtime = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"normalspeed")) - plr->normalspeed = (fixed_t)luaL_checkinteger(L, 3); + plr->normalspeed = luaL_checkfixed(L, 3); else if (fastcmp(field,"runspeed")) - plr->runspeed = (fixed_t)luaL_checkinteger(L, 3); + plr->runspeed = luaL_checkfixed(L, 3); else if (fastcmp(field,"thrustfactor")) plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"accelstart")) @@ -433,7 +433,7 @@ static int player_set(lua_State *L) else if (fastcmp(field,"gotcontinue")) plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"speed")) - plr->speed = (fixed_t)luaL_checkinteger(L, 3); + plr->speed = luaL_checkfixed(L, 3); else if (fastcmp(field,"jumping")) plr->jumping = luaL_checkboolean(L, 3); else if (fastcmp(field,"secondjump")) @@ -455,13 +455,13 @@ static int player_set(lua_State *L) else if (fastcmp(field,"skidtime")) plr->skidtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"cmomx")) - plr->cmomx = (fixed_t)luaL_checkinteger(L, 3); + plr->cmomx = luaL_checkfixed(L, 3); else if (fastcmp(field,"cmomy")) - plr->cmomy = (fixed_t)luaL_checkinteger(L, 3); + plr->cmomy = luaL_checkfixed(L, 3); else if (fastcmp(field,"rmomx")) - plr->rmomx = (fixed_t)luaL_checkinteger(L, 3); + plr->rmomx = luaL_checkfixed(L, 3); else if (fastcmp(field,"rmomy")) - plr->rmomy = (fixed_t)luaL_checkinteger(L, 3); + plr->rmomy = luaL_checkfixed(L, 3); else if (fastcmp(field,"numboxes")) plr->numboxes = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"totalring")) @@ -489,11 +489,11 @@ static int player_set(lua_State *L) else if (fastcmp(field,"starposttime")) plr->starposttime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"starpostangle")) - plr->starpostangle = (angle_t)luaL_checkinteger(L, 3); + plr->starpostangle = luaL_checkangle(L, 3); else if (fastcmp(field,"angle_pos")) - plr->angle_pos = (angle_t)luaL_checkinteger(L, 3); + plr->angle_pos = luaL_checkangle(L, 3); else if (fastcmp(field,"old_angle_pos")) - plr->old_angle_pos = (angle_t)luaL_checkinteger(L, 3); + plr->old_angle_pos = luaL_checkangle(L, 3); else if (fastcmp(field,"axis1")) P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ))); else if (fastcmp(field,"axis2")) @@ -569,7 +569,7 @@ static int player_set(lua_State *L) P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now. } else if (fastcmp(field,"awayviewaiming")) - plr->awayviewaiming = (angle_t)luaL_checkinteger(L, 3); + plr->awayviewaiming = luaL_checkangle(L, 3); else if (fastcmp(field,"spectator")) plr->spectator = lua_toboolean(L, 3); else if (fastcmp(field,"bot")) @@ -578,7 +578,7 @@ static int player_set(lua_State *L) plr->jointime = (tic_t)luaL_checkinteger(L, 3); #ifdef HWRENDER else if (fastcmp(field,"fovadd")) - plr->fovadd = (fixed_t)luaL_checkinteger(L, 3); + plr->fovadd = luaL_checkfixed(L, 3); #endif else { lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); diff --git a/src/lua_script.c b/src/lua_script.c index 8b40d9f00..a5b56bf71 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -442,7 +442,6 @@ enum ARCH_NULL=0, ARCH_BOOLEAN, ARCH_SIGNED, - ARCH_UNSIGNED, ARCH_STRING, ARCH_TABLE, @@ -522,13 +521,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) case LUA_TNUMBER: { lua_Integer number = lua_tointeger(gL, myindex); - if (number < 0) { - WRITEUINT8(save_p, ARCH_SIGNED); - WRITEFIXED(save_p, number); - } else { - WRITEUINT8(save_p, ARCH_UNSIGNED); - WRITEANGLE(save_p, number); - } + WRITEUINT8(save_p, ARCH_SIGNED); + WRITEFIXED(save_p, number); break; } case LUA_TSTRING: @@ -797,9 +791,6 @@ static UINT8 UnArchiveValue(int TABLESINDEX) case ARCH_SIGNED: lua_pushinteger(gL, READFIXED(save_p)); break; - case ARCH_UNSIGNED: - lua_pushinteger(gL, READANGLE(save_p)); - break; case ARCH_STRING: { char value[1024]; diff --git a/src/lua_script.h b/src/lua_script.h index eaef13d1e..8437045ec 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -19,9 +19,21 @@ #include "blua/lua.h" #include "blua/lualib.h" #include "blua/lauxlib.h" + #define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i)) #define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i)) +// fixed_t casting +// TODO add some distinction between fixed numbers and integer numbers +// for at least the purpose of printing and maybe math. +#define luaL_checkfixed(L, i) luaL_checkinteger(L, i) +#define lua_pushfixed(L, f) lua_pushinteger(L, f) + +// angle_t casting +// we reduce the angle to a fixed point between 0.0 and 1.0 +#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16) +#define lua_pushangle(L, a) lua_pushfixed(L, a>>16) + #ifdef _DEBUG void LUA_ClearExtVars(void); #endif diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index f797f30d6..f07b4564c 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -147,19 +147,19 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->revitem); break; case skin_actionspd: - lua_pushinteger(L, skin->actionspd); + lua_pushfixed(L, skin->actionspd); break; case skin_mindash: - lua_pushinteger(L, skin->mindash); + lua_pushfixed(L, skin->mindash); break; case skin_maxdash: - lua_pushinteger(L, skin->maxdash); + lua_pushfixed(L, skin->maxdash); break; case skin_normalspeed: - lua_pushinteger(L, skin->normalspeed); + lua_pushfixed(L, skin->normalspeed); break; case skin_runspeed: - lua_pushinteger(L, skin->runspeed); + lua_pushfixed(L, skin->runspeed); break; case skin_thrustfactor: lua_pushinteger(L, skin->thrustfactor); @@ -171,7 +171,7 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->acceleration); break; case skin_jumpfactor: - lua_pushinteger(L, skin->jumpfactor); + lua_pushfixed(L, skin->jumpfactor); break; case skin_starttranscolor: lua_pushinteger(L, skin->starttranscolor); From dfa8ac7ccb38d616bb73870c740b20cb05545b33 Mon Sep 17 00:00:00 2001 From: JTE Date: Thu, 21 May 2015 19:05:17 -0400 Subject: [PATCH 07/30] Added sidedef texture and offset manipulation to Lua. --- src/lua_maplib.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 82bd78f73..2dd922a3a 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -658,6 +658,50 @@ static int side_get(lua_State *L) return 0; } +static int side_set(lua_State *L) +{ + side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE)); + enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt); + + if (!side) + { + if (field == side_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed side_t doesn't exist anymore."); + } + + switch(field) + { + case side_valid: // valid + case side_sector: + case side_special: + case side_text: + default: + return luaL_error(L, "side_t field " LUA_QS " cannot be set.", side_opt[field]); + case side_textureoffset: + side->textureoffset = luaL_checkfixed(L, 3); + break; + case side_rowoffset: + side->rowoffset = luaL_checkfixed(L, 3); + break; + case side_toptexture: + side->toptexture = luaL_checkinteger(L, 3); + break; + case side_bottomtexture: + side->bottomtexture = luaL_checkinteger(L, 3); + break; + case side_midtexture: + side->midtexture = luaL_checkinteger(L, 3); + break; + case side_repeatcnt: + side->repeatcnt = luaL_checkinteger(L, 3); + break; + } + return 0; +} + static int side_num(lua_State *L) { side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE)); @@ -1214,6 +1258,9 @@ int LUA_MapLib(lua_State *L) lua_pushcfunction(L, side_get); lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, side_set); + lua_setfield(L, -2, "__newindex"); + lua_pushcfunction(L, side_num); lua_setfield(L, -2, "__len"); lua_pop(L, 1); From 6ee50e803b0cb4137b611e62aa4d81559dc2c157 Mon Sep 17 00:00:00 2001 From: JTE Date: Thu, 21 May 2015 19:55:22 -0400 Subject: [PATCH 08/30] Wrapped Lua MapLoad hook in P_MapStart / P_MapEnd. This fixes a crash if a script tries to use a MapLoad hook to immediately edit the map in some way the moment it finishes loading. --- src/p_setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_setup.c b/src/p_setup.c index f2b0c49d8..c071fa62b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2786,7 +2786,9 @@ boolean P_SetupLevel(boolean skipprecip) } P_PreTicker(2); #ifdef HAVE_BLUA + P_MapStart(); LUAh_MapLoad(); + P_MapEnd(); #endif } From c91cd3860b51f688721f119e1efb67734afd40bc Mon Sep 17 00:00:00 2001 From: JTE Date: Fri, 22 May 2015 01:46:59 -0400 Subject: [PATCH 09/30] Revert "Wrapped Lua MapLoad hook in P_MapStart / P_MapEnd." This reverts commit 6ee50e803b0cb4137b611e62aa4d81559dc2c157. --- src/p_setup.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index c071fa62b..f2b0c49d8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2786,9 +2786,7 @@ boolean P_SetupLevel(boolean skipprecip) } P_PreTicker(2); #ifdef HAVE_BLUA - P_MapStart(); LUAh_MapLoad(); - P_MapEnd(); #endif } From f783df718cbd902e35b3f054e9dcc02429df27ce Mon Sep 17 00:00:00 2001 From: JTE Date: Fri, 22 May 2015 01:51:40 -0400 Subject: [PATCH 10/30] Reset tmthing after P_CheckSector calls from Lua tmthing must not be set outside of P_MapStart and P_MapEnd or the game will fail a sanity check which ensures that mobj references are not persistent across frames and crash. --- src/lua_maplib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 2dd922a3a..0a12478ca 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -396,6 +396,7 @@ static int sector_set(lua_State *L) return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); case sector_floorheight: { // floorheight boolean flag; + mobj_t *ptmthing = tmthing; fixed_t lastpos = sector->floorheight; sector->floorheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); @@ -404,10 +405,12 @@ static int sector_set(lua_State *L) sector->floorheight = lastpos; P_CheckSector(sector, true); } + P_SetTarget(&tmthing, ptmthing); break; } case sector_ceilingheight: { // ceilingheight boolean flag; + mobj_t *ptmthing = tmthing; fixed_t lastpos = sector->ceilingheight; sector->ceilingheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); @@ -416,6 +419,7 @@ static int sector_set(lua_State *L) sector->ceilingheight = lastpos; P_CheckSector(sector, true); } + P_SetTarget(&tmthing, ptmthing); break; } case sector_floorpic: @@ -1071,6 +1075,7 @@ static int ffloor_set(lua_State *L) case ffloor_topheight: { // topheight boolean flag; fixed_t lastpos = *ffloor->topheight; + mobj_t *ptmthing = tmthing; sector_t *sector = §ors[ffloor->secnum]; sector->ceilingheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); @@ -1079,6 +1084,7 @@ static int ffloor_set(lua_State *L) *ffloor->topheight = lastpos; P_CheckSector(sector, true); } + P_SetTarget(&tmthing, ptmthing); break; } case ffloor_toppic: @@ -1090,6 +1096,7 @@ static int ffloor_set(lua_State *L) case ffloor_bottomheight: { // bottomheight boolean flag; fixed_t lastpos = *ffloor->bottomheight; + mobj_t *ptmthing = tmthing; sector_t *sector = §ors[ffloor->secnum]; sector->floorheight = luaL_checkfixed(L, 3); flag = P_CheckSector(sector, true); @@ -1098,6 +1105,7 @@ static int ffloor_set(lua_State *L) *ffloor->bottomheight = lastpos; P_CheckSector(sector, true); } + P_SetTarget(&tmthing, ptmthing); break; } case ffloor_bottompic: From 3bc56a91b261d69b0f9bbba84e8af5f6922e3117 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 04:34:53 -0400 Subject: [PATCH 11/30] Hotfix for platform movement being dropped on players. Now players will apply platform movement when jumping, but only if the platform is moving the same direction as their jump is, and all other objects will have an appropriate pmomz in reverse gravity FOF situations. --- src/p_map.c | 6 +++++- src/p_mobj.c | 49 ++++++++++--------------------------------------- src/p_user.c | 12 +++++++++--- 3 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 62cbf7b77..4b2ea52cc 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2047,6 +2047,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) // static boolean P_ThingHeightClip(mobj_t *thing) { + boolean floormoved; fixed_t oldfloorz = thing->floorz; boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); @@ -2058,6 +2059,9 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (P_MobjWasRemoved(thing)) return true; + floormoved = (thing->eflags & MFE_VERTICALFLIP && tmceilingz != thing->ceilingz) + || (!(thing->eflags & MFE_VERTICALFLIP) && tmfloorz != thing->floorz); + thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; @@ -2066,7 +2070,7 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (tmfloorz > oldfloorz+thing->height) return true; - if (/*!tmfloorthing && */onfloor && !(thing->flags & MF_NOGRAVITY)) + if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved) { if (thing->eflags & MFE_VERTICALFLIP) thing->pmomz = thing->ceilingz - (thing->z + thing->height); diff --git a/src/p_mobj.c b/src/p_mobj.c index cac4bc24b..f1fc6bb78 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1986,12 +1986,8 @@ static void P_PlayerZMovement(mobj_t *mo) (FixedMul(cv_viewheight.value<scale) - mo->player->viewheight)>>3; } - // adjust height -/* if (mo->pmomz && mo->z > mo->floorz && !(mo->player->pflags & PF_JUMPED)) - { - mo->momz += mo->pmomz; + if (mo->pmomz && mo->z > mo->floorz) mo->pmomz = 0; - }*/ mo->z += mo->momz; @@ -2899,6 +2895,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) msecnode_t *node; I_Assert(mobj != NULL); + I_Assert(mobj->player != NULL); I_Assert(!P_MobjWasRemoved(mobj)); P_MobjCheckWater(mobj); @@ -2917,7 +2914,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) P_CheckPosition(mobj, mobj->x, mobj->y); goto animonly; } - else if (mobj->player && (mobj->player->pflags & PF_MACESPIN) && mobj->tracer) + else if (mobj->player->pflags & PF_MACESPIN && mobj->tracer) { P_CheckPosition(mobj, mobj->x, mobj->y); goto animonly; @@ -2936,7 +2933,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) else P_TryMove(mobj, mobj->x, mobj->y, true); - if (!(netgame && mobj->player && mobj->player->spectator)) + if (!(netgame && mobj->player->spectator)) { // Crumbling platforms for (node = mobj->touching_sectorlist; node; node = node->m_snext) @@ -3019,18 +3016,14 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } else { - if (mobj->player) + mobj->player->jumping = 0; + mobj->player->pflags &= ~PF_JUMPED; + if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) { - mobj->player->jumping = 0; - mobj->player->pflags &= ~PF_JUMPED; - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) - { - mobj->player->secondjump = 0; - mobj->player->powers[pw_tailsfly] = 0; - P_SetPlayerMobjState(mobj, S_PLAY_RUN1); - } + mobj->player->secondjump = 0; + mobj->player->powers[pw_tailsfly] = 0; + P_SetPlayerMobjState(mobj, S_PLAY_RUN1); } - mobj->pmomz = 0; mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -6643,17 +6636,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s } else { - if (mobj->player) - { - mobj->player->jumping = 0; - mobj->player->pflags &= ~PF_JUMPED; - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) - { - mobj->player->secondjump = 0; - mobj->player->powers[pw_tailsfly] = 0; - P_SetPlayerMobjState(mobj, S_PLAY_RUN1); - } - } mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -6854,17 +6836,6 @@ void P_SceneryThinker(mobj_t *mobj) } else { - if (mobj->player) - { - mobj->player->jumping = 0; - mobj->player->pflags &= ~PF_JUMPED; - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) - { - mobj->player->secondjump = 0; - mobj->player->powers[pw_tailsfly] = 0; - P_SetPlayerMobjState(mobj, S_PLAY_RUN1); - } - } mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->eflags &= ~MFE_JUSTHITFLOOR; } diff --git a/src/p_user.c b/src/p_user.c index 6844d2cba..c5c5ab73b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3619,11 +3619,18 @@ void P_DoJump(player_t *player, boolean soundandstate) // set just an eensy above the ground if (player->mo->eflags & MFE_VERTICALFLIP) + { player->mo->z--; + if (player->mo->pmomz < 0) + player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. + } else + { player->mo->z++; - - player->mo->z += player->mo->pmomz; // Solves problem of 'hitting around again after jumping on a moving platform'. + if (player->mo->pmomz > 0) + player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. + } + player->mo->pmomz = 0; player->pflags |= PF_JUMPED; @@ -9028,7 +9035,6 @@ void P_PlayerThink(player_t *player) player->mo->tracer->flags2 &= ~MF2_DONTDRAW; } - player->mo->pmomz = 0; player->pflags &= ~PF_SLIDING; /* From 213a0caa23f3651a50e30262af256c4d45cada52 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 05:47:01 -0400 Subject: [PATCH 12/30] Hotfix amendment Also gain velocity from walking off an "up" elevator normally? This _looks_ incorrect because the camera stops matching the platform movement the moment you step off, but I assure you it is a correct and accurate movement. (Try it with chasecam off.) --- src/p_mobj.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f1fc6bb78..4796e18b0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1986,8 +1986,14 @@ static void P_PlayerZMovement(mobj_t *mo) (FixedMul(cv_viewheight.value<scale) - mo->player->viewheight)>>3; } - if (mo->pmomz && mo->z > mo->floorz) + // adjust height + if (mo->pmomz && !P_IsObjectOnGround(mo)) + { + if ((mo->eflags & MFE_VERTICALFLIP && mo->pmomz < 0) + || (!(mo->eflags & MFE_VERTICALFLIP) && mo->pmomz > 0)) + mo->momz += mo->pmomz; mo->pmomz = 0; + } mo->z += mo->momz; From c6ade27b6aac1483089240d7ccae04f450d92088 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 29 May 2015 14:59:13 +0100 Subject: [PATCH 13/30] Fixes to CTF flag respawning, particularly reverse gravity and z-positioning. --- src/p_mobj.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 081124b95..092005c43 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6497,19 +6497,22 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->spawnpoint->options & MTF_OBJECTFLIP) { z = ss->sector->ceilingheight - mobjinfo[mobj->type].height; - if (mobj->spawnpoint->z) - z -= mobj->spawnpoint->z << FRACBITS; + if (mobj->spawnpoint->options >> ZSHIFT) + z -= (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS; } else { z = ss->sector->floorheight; - if (mobj->spawnpoint->z) - z += mobj->spawnpoint->z << FRACBITS; + if (mobj->spawnpoint->options >> ZSHIFT) + z += (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS; } flagmo = P_SpawnMobj(x, y, z, mobj->type); flagmo->spawnpoint = mobj->spawnpoint; if (mobj->spawnpoint->options & MTF_OBJECTFLIP) - flagmo->spawnpoint->options |= MTF_OBJECTFLIP; + { + flagmo->eflags |= MFE_VERTICALFLIP; + flagmo->flags2 |= MF2_OBJECTFLIP; + } if (mobj->type == MT_REDFLAG) { From a1c67e7e67c10b5825cc8df23c90ad27cdcb2d36 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 13:53:06 -0400 Subject: [PATCH 14/30] Add MFE_APPLYPMOMZ to fix camera movement. Here's how it works: When a player walks off the moving platform, it applies their pmomz once, and then _keeps pmomz set_ so that the camera still adds pmomz to its movements until they hit another floor. This way, the camera doesn't jerk around. --- src/dehacked.c | 4 +-- src/lua_mobjlib.c | 1 + src/p_map.c | 9 +------ src/p_mobj.c | 62 +++++++++++++++++++++++------------------------ src/p_mobj.h | 3 ++- src/p_user.c | 6 ++++- 6 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index a332da5df..3b463f7f2 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7193,7 +7193,7 @@ static const char *const MOBJFLAG2_LIST[] = { NULL }; -static const char *const MOBJEFLAG_LIST[] = { +static const char *const MOBJEFLAG_LIST[8] = { "ONGROUND", // The mobj stands on solid floor (not on another mobj or in air) "JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame "TOUCHWATER", // The mobj stands in a sector with water, and touches the surface @@ -7201,7 +7201,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - NULL + "APPLYPMOMZ" // Platform movement }; static const char *const MAPTHINGFLAG_LIST[4] = { diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index f455edf1f..b5bf25d82 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -449,6 +449,7 @@ static int mobj_set(lua_State *L) break; case mobj_pmomz: mo->pmomz = (fixed_t)luaL_checkinteger(L, 3); + mo->eflags |= MFE_APPLYPMOMZ; break; case mobj_tics: mo->tics = luaL_checkinteger(L, 3); diff --git a/src/p_map.c b/src/p_map.c index 4b2ea52cc..ca11ae2e1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2076,14 +2076,7 @@ static boolean P_ThingHeightClip(mobj_t *thing) thing->pmomz = thing->ceilingz - (thing->z + thing->height); else thing->pmomz = thing->floorz - thing->z; - - if (thing->player) - { - if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer]) - camera2.z += thing->pmomz; - else if (camera.chase && thing->player == &players[displayplayer]) - camera.z += thing->pmomz; - } + thing->eflags |= MFE_APPLYPMOMZ; if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->ceilingz - thing->height; diff --git a/src/p_mobj.c b/src/p_mobj.c index 4796e18b0..bbd5d3fe1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1493,12 +1493,13 @@ static void P_RingZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - if (mo->pmomz && mo->z != mo->floorz) + mo->z += mo->momz; + + if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; - mo->pmomz = 0; + mo->eflags &= ~MFE_APPLYPMOMZ; } - mo->z += mo->momz; // clip movement if (mo->z <= mo->floorz && !(mo->flags & MF_NOCLIPHEIGHT)) @@ -1562,12 +1563,13 @@ static boolean P_ZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - if (mo->pmomz && mo->z != mo->floorz) + mo->z += mo->momz; + + if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; - mo->pmomz = 0; + mo->eflags &= ~MFE_APPLYPMOMZ; } - mo->z += mo->momz; switch (mo->type) { @@ -1987,16 +1989,14 @@ static void P_PlayerZMovement(mobj_t *mo) } // adjust height - if (mo->pmomz && !P_IsObjectOnGround(mo)) - { - if ((mo->eflags & MFE_VERTICALFLIP && mo->pmomz < 0) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->pmomz > 0)) - mo->momz += mo->pmomz; - mo->pmomz = 0; - } - mo->z += mo->momz; + if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) + { + mo->momz += mo->pmomz; + mo->eflags &= ~MFE_APPLYPMOMZ; + } + // Have player fall through floor? if (mo->player->playerstate == PST_DEAD || mo->player->playerstate == PST_REBORN) @@ -2010,7 +2010,7 @@ static void P_PlayerZMovement(mobj_t *mo) else mo->z = mo->floorz; - if (mo->player && (mo->player->pflags & PF_NIGHTSMODE)) + if (mo->player->pflags & PF_NIGHTSMODE) { if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) mo->player->flyangle += P_MobjFlip(mo)*90; @@ -2025,12 +2025,11 @@ static void P_PlayerZMovement(mobj_t *mo) if (P_MobjFlip(mo)*mo->momz < 0) // falling { + mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement. + // Squat down. Decrease viewheight for a moment after hitting the ground (hard), - if (mo->player) - { - if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale)) - mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative - } + if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale)) + mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack @@ -2103,14 +2102,14 @@ static void P_PlayerZMovement(mobj_t *mo) // Cut momentum in half when you hit the ground and // aren't pressing any controls. - if (!mo->player || (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))) + if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING)) { mo->momx = mo->momx/2; mo->momy = mo->momy/2; } } - if (mo->health && mo->player) + if (mo->health) { if (mo->player->pflags & PF_GLIDING) // ground gliding { @@ -2156,7 +2155,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->powers[pw_tailsfly] = 0; } } - if (mo->player && !(mo->player->pflags & PF_SPINNING)) + if (!(mo->player->pflags & PF_SPINNING)) mo->player->pflags &= ~PF_STARTDASH; if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) @@ -2199,7 +2198,7 @@ nightsdone: else mo->z = mo->ceilingz - mo->height; - if (mo->player && (mo->player->pflags & PF_NIGHTSMODE)) + if (mo->player->pflags & PF_NIGHTSMODE) { if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) mo->player->flyangle -= P_MobjFlip(mo)*90; @@ -2214,7 +2213,7 @@ nightsdone: { msecnode_t *node; - if (CheckForMarioBlocks && mo->player && !(netgame && mo->player->spectator)) // Only let the player punch + if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch { // Search the touching sectors, from side-to-side... for (node = mo->touching_sectorlist; node; node = node->m_snext) @@ -2242,7 +2241,7 @@ nightsdone: if (mariomode) S_StartSound(mo, sfx_mario1); - if (!(mo->player && mo->player->climbing)) + if (!mo->player->climbing) mo->momz = 0; } } @@ -2257,12 +2256,13 @@ static boolean P_SceneryZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - if (mo->pmomz && mo->z != mo->floorz) + mo->z += mo->momz; + + if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; - mo->pmomz = 0; + mo->eflags &= ~MFE_APPLYPMOMZ; } - mo->z += mo->momz; switch (mo->type) { @@ -2840,10 +2840,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled thiscam->floorz = tmfloorz; thiscam->ceilingz = tmceilingz; - if (thiscam->momz) + if (thiscam->momz || player->mo->pmomz) { // adjust height - thiscam->z += thiscam->momz; + thiscam->z += thiscam->momz + player->mo->pmomz; if (!itsatwodlevel && !(player->pflags & PF_NOCLIP)) { diff --git a/src/p_mobj.h b/src/p_mobj.h index 6d120c473..c07b96211 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,7 +232,8 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 + // Platform movement + MFE_APPLYPMOMZ = 1<<7 } mobjeflag_t; // diff --git a/src/p_user.c b/src/p_user.c index c5c5ab73b..d6fc5b35a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3623,14 +3623,18 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->z--; if (player->mo->pmomz < 0) player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. + else + player->mo->pmomz = 0; } else { player->mo->z++; if (player->mo->pmomz > 0) player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. + else + player->mo->pmomz = 0; } - player->mo->pmomz = 0; + player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= PF_JUMPED; From c16516ef0db316f9469f1e1d4ca6a94f238d8ee1 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 17:22:31 -0400 Subject: [PATCH 15/30] Partial revert. This partially reverts commit a1c67e7e67c10b5825cc8df23c90ad27cdcb2d36. --- src/dehacked.c | 2 +- src/p_mobj.c | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3b463f7f2..b3bbc343b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7193,7 +7193,7 @@ static const char *const MOBJFLAG2_LIST[] = { NULL }; -static const char *const MOBJEFLAG_LIST[8] = { +static const char *const MOBJEFLAG_LIST[] = { "ONGROUND", // The mobj stands on solid floor (not on another mobj or in air) "JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame "TOUCHWATER", // The mobj stands in a sector with water, and touches the surface diff --git a/src/p_mobj.c b/src/p_mobj.c index bbd5d3fe1..e7e7b8678 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1493,13 +1493,12 @@ static void P_RingZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - mo->z += mo->momz; - if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; mo->eflags &= ~MFE_APPLYPMOMZ; } + mo->z += mo->momz; // clip movement if (mo->z <= mo->floorz && !(mo->flags & MF_NOCLIPHEIGHT)) @@ -1563,13 +1562,12 @@ static boolean P_ZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - mo->z += mo->momz; - if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; mo->eflags &= ~MFE_APPLYPMOMZ; } + mo->z += mo->momz; switch (mo->type) { @@ -1989,14 +1987,14 @@ static void P_PlayerZMovement(mobj_t *mo) } // adjust height - mo->z += mo->momz; - if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; mo->eflags &= ~MFE_APPLYPMOMZ; } + mo->z += mo->momz; + // Have player fall through floor? if (mo->player->playerstate == PST_DEAD || mo->player->playerstate == PST_REBORN) @@ -2256,13 +2254,12 @@ static boolean P_SceneryZMovement(mobj_t *mo) P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector); // adjust height - mo->z += mo->momz; - if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; mo->eflags &= ~MFE_APPLYPMOMZ; } + mo->z += mo->momz; switch (mo->type) { From b88600dac6a3b0e3b0b94d3156517074aae746ba Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 May 2015 13:57:27 +0100 Subject: [PATCH 16/30] tmfloorthing and tmhitthing are set to NULL at the start of P_MobjThinker, preventing any weird cases of carrying over the previous mobj's floor object or such. This fixes the issue with upside-down springs shooting downwards if you touch another of its kind. Also fixes one of the issues with monitors in Icicle Falls (after you phase inside the East-most float-bob FOF's monitor via the other bug and jump up to break it while there, the NEXT monitor moves upwards too) --- src/p_local.h | 2 +- src/p_map.c | 2 +- src/p_mobj.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 926a51788..59179c1c1 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -276,7 +276,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed extern boolean floatok; extern fixed_t tmfloorz; extern fixed_t tmceilingz; -extern mobj_t *tmfloorthing, *tmthing; +extern mobj_t *tmfloorthing, *tmhitthing, *tmthing; extern camera_t *mapcampointer; /* cphipps 2004/08/30 */ diff --git a/src/p_map.c b/src/p_map.c index c88b91e94..a29ae9512 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -47,7 +47,7 @@ boolean floatok; fixed_t tmfloorz, tmceilingz; static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector -static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) +mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls diff --git a/src/p_mobj.c b/src/p_mobj.c index 092005c43..24a9f7b58 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5450,6 +5450,8 @@ void P_MobjThinker(mobj_t *mobj) mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG); + tmfloorthing = tmhitthing = NULL; + // 970 allows ANY mobj to trigger a linedef exec if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8) { From 9a9025b1ee3a3396d9a4e82749e4a6b96876e54a Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Tue, 9 Jun 2015 06:59:34 -0400 Subject: [PATCH 17/30] Remove pmomz from players who are on ground. Assume that every frame the player is on the ground, their pmomz will be re-set properly if the floor is moving, therefore if the platform STOPS, we need this to set it to 0. --- src/p_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index d6fc5b35a..ce6e2b732 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9391,4 +9391,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->flags2 |= MF2_DONTDRAW; player->mo->flags |= MF_NOGRAVITY; } + + if (P_IsObjectOnGround(player->mo)) + player->mo->pmomz = 0; } From 36cf4c1bd25452e8e1e2fa8c49097329c6994702 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Tue, 9 Jun 2015 19:51:33 -0400 Subject: [PATCH 18/30] Fix comma error. --- src/dehacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 5f1f89ec2..376826149 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7204,7 +7204,7 @@ static const char *const MOBJEFLAG_LIST[] = { "GOOWATER", // Goo water "PUSHED", // Mobj was already pushed this tic "SPRUNG", // Mobj was already sprung this tic - "APPLYPMOMZ" // Platform movement + "APPLYPMOMZ", // Platform movement NULL }; From ecdf3412c0f60b0d6a15ac1888783f9ffb348418 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 07:28:09 -0400 Subject: [PATCH 19/30] Rewrote the entirety of lua_hooklib.c This _should_ solve some significant performance issues Lua experiences. If not, I will be very upset for having wasted so much time and effort. There will be bugs, this kind of thing needs to be thuroughly tested and this is just the first iteration of it. --- src/lua_hook.h | 9 +- src/lua_hooklib.c | 1048 ++++++++++++++++++--------------------------- src/p_inter.c | 2 +- 3 files changed, 414 insertions(+), 645 deletions(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index fae3bb7e6..da2dcdc38 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -41,7 +41,7 @@ enum hook { hook_BotAI, hook_LinedefExecute, hook_PlayerMsg, - hook_DeathMsg, + hook_HurtMsg, hook_MAX // last hook }; @@ -54,8 +54,9 @@ void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers) boolean LUAh_MobjHook(mobj_t *mo, enum hook which); boolean LUAh_PlayerHook(player_t *plr, enum hook which); #define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type -UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type -UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type +UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which); +#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type +#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type #define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type #define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type @@ -73,6 +74,6 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages -boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages +boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 532726ac2..c314ed045 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -56,23 +56,40 @@ const char *const hookNames[hook_MAX+1] = { NULL }; +// Hook metadata +struct hook_s +{ + struct hook_s *next; + enum hook type; + UINT16 id; + union { + mobjtype_t mt; + char *skinname; + char *funcname; + } s; + boolean error; +}; +typedef struct hook_s* hook_p; + +#define FMT_HOOKID "hook_%04x" + +hook_p roothook; + // Takes hook, function, and additional arguments (mobj type to act on, etc.) static int lib_addHook(lua_State *L) { - UINT16 hook; - boolean notable = false; - boolean subtable = false; - UINT32 subindex = 0; - char *subfield = NULL; - const char *lsubfield = NULL; + static struct hook_s hook = {NULL, 0, 0, {0}, false}; + hook_p hookp, *lastp; - hook = (UINT16)luaL_checkoption(L, 1, NULL, hookNames); - luaL_checktype(L, 2, LUA_TFUNCTION); + hook.type = luaL_checkoption(L, 1, NULL, hookNames); + lua_remove(L, 1); + + luaL_checktype(L, 1, LUA_TFUNCTION); if (hud_running) return luaL_error(L, "HUD rendering code should not call this function!"); - switch(hook) + switch(hook.type) { // Take a mobjtype enum which this hook is specifically for. case hook_MobjSpawn: @@ -87,277 +104,140 @@ static int lib_addHook(lua_State *L) case hook_MobjDeath: case hook_BossDeath: case hook_MobjRemoved: - subtable = true; - if (lua_isnumber(L, 3)) - subindex = (UINT32)luaL_checkinteger(L, 3); - else - lsubfield = "a"; - lua_settop(L, 2); + case hook_HurtMsg: + hook.s.mt = MT_NULL; + if (lua_isnumber(L, 2)) + hook.s.mt = lua_tonumber(L, 2); break; - case hook_BotAI: // Only one AI function per skin, please! - notable = true; - subtable = true; - subfield = ZZ_Alloc(strlen(luaL_checkstring(L, 3))+1); + case hook_BotAI: + hook.s.skinname = NULL; + if (lua_isstring(L, 2)) { // lowercase copy - char *p = subfield; - const char *s = luaL_checkstring(L, 3); + const char *s = lua_tostring(L, 2); + char *p = hook.s.skinname = ZZ_Alloc(strlen(s)+1); do { *p = tolower(*s); ++p; } while(*(++s)); *p = 0; } - lua_settop(L, 3); break; - case hook_LinedefExecute: // Get one linedef executor function by name - notable = true; - subtable = true; - subfield = ZZ_Alloc(strlen(luaL_checkstring(L, 3))+1); + case hook_LinedefExecute: // Linedef executor functions { // uppercase copy - char *p = subfield; - const char *s = luaL_checkstring(L, 3); + const char *s = luaL_checkstring(L, 2); + char *p = hook.s.funcname = ZZ_Alloc(strlen(s)+1); do { *p = toupper(*s); ++p; } while(*(++s)); *p = 0; } - lua_settop(L, 3); break; default: - lua_settop(L, 2); break; } + lua_settop(L, 1); // lua stack contains only the function now. - lua_getfield(L, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(L, -1)); + hooksAvailable[hook.type/8] |= 1<<(hook.type%8); - // This hook type only allows one entry, not an array of hooks. - // New hooks will overwrite the previous ones, and the stack is one table shorter. - if (notable) + // iterate the hook metadata structs + // set hook.id to the highest id + 1 + // set lastp to the last hook struct's "next" pointer. + lastp = &roothook; + hook.id = 0; + for (hookp = roothook; hookp; hookp = hookp->next) { - if (subtable) - { - lua_rawgeti(L, -1, hook); - lua_remove(L, -2); // pop "hook" - I_Assert(lua_istable(L, -1)); - lua_pushvalue(L, 2); - if (subfield) - lua_setfield(L, -2, subfield); - else if (lsubfield) - lua_setfield(L, -2, lsubfield); - else - lua_rawseti(L, -2, subindex); - } else { - lua_pushvalue(L, 2); - lua_rawseti(L, -2, hook); - } - hooksAvailable[hook/8] |= 1<<(hook%8); - return 0; + if (hookp->id >= hook.id) + hook.id = hookp->id+1; + lastp = &hookp->next; } - // Fetch the hook's table from the registry. - // It should always exist, since LUA_HookLib creates a table for every hook. - lua_rawgeti(L, -1, hook); - lua_remove(L, -2); // pop "hook" - I_Assert(lua_istable(L, -1)); - if (subtable) - { - // Fetch a subtable based on index - if (subfield) - lua_getfield(L, -1, subfield); - else if (lsubfield) - lua_getfield(L, -1, lsubfield); - else - lua_rawgeti(L, -1, subindex); + // allocate a permanent memory struct to stuff hook. + hookp = ZZ_Alloc(sizeof(struct hook_s)); + memcpy(hookp, &hook, sizeof(struct hook_s)); + // tack it onto the end of the linked list. + *lastp = hookp; - // Subtable doesn't exist, make one now. - if (lua_isnil(L, -1)) - { - lua_pop(L, 1); - lua_newtable(L); - - // Store a link to the subtable for later. - lua_pushvalue(L, -1); - if (subfield) - lua_setfield(L, -3, subfield); - else if (lsubfield) - lua_setfield(L, -3, lsubfield); - else - lua_rawseti(L, -3, subindex); - } } - - // Add function to the table. - lua_pushvalue(L, 2); - lua_rawseti(L, -2, (int)(lua_objlen(L, -2) + 1)); - - if (subfield) - Z_Free(subfield); - - hooksAvailable[hook/8] |= 1<<(hook%8); + // set the hook function in the registry. + lua_pushfstring(L, FMT_HOOKID, hook.id); + lua_pushvalue(L, 1); + lua_settable(L, LUA_REGISTRYINDEX); return 0; } int LUA_HookLib(lua_State *L) { - // Create all registry tables - enum hook i; memset(hooksAvailable,0,sizeof(UINT8[(hook_MAX/8)+1])); - - lua_newtable(L); - for (i = 0; i < hook_MAX; i++) - { - lua_newtable(L); - switch(i) - { - default: - break; - case hook_MobjSpawn: - case hook_MobjCollide: - case hook_MobjMoveCollide: - case hook_TouchSpecial: - case hook_MobjFuse: - case hook_MobjThinker: - case hook_BossThinker: - case hook_ShouldDamage: - case hook_MobjDamage: - case hook_MobjDeath: - case hook_BossDeath: - case hook_MobjRemoved: - lua_pushstring(L, "a"); - lua_newtable(L); - lua_rawset(L, -3); - break; - } - lua_rawseti(L, -2, i); - } - lua_setfield(L, LUA_REGISTRYINDEX, "hook"); + roothook = NULL; lua_register(L, "addHook", lib_addHook); return 0; } boolean LUAh_MobjHook(mobj_t *mo, enum hook which) { + hook_p hookp; boolean hooked = false; if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return false; - // clear the stack (just in case) lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, which); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // generic subtable - lua_pushstring(gL, "a"); - lua_rawget(gL, -2); - I_Assert(lua_istable(gL, -1)); - LUA_PushUserdata(gL, mo, META_MOBJ); - lua_pushnil(gL); - while (lua_next(gL, -3)) { - CONS_Debug(DBG_LUA, "MobjHook: Calling hook_%s for generic mobj types\n", hookNames[which]); - lua_pushvalue(gL, -3); // mo - // stack is: hook_Mobj table, subtable "a", mobj, i, function, mobj - if (lua_pcall(gL, 1, 1, 0)) { - // A run-time error occurred. - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); - lua_pop(gL, 1); - // Remove this function from the hook table to prevent further errors. - lua_pushvalue(gL, -1); // key - lua_pushnil(gL); // value - lua_rawset(gL, -5); // table - CONS_Printf("Hook removed.\n"); - } - else + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == which + && (hookp->s.mt == MT_NULL || hookp->s.mt == mo->type)) { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } if (lua_toboolean(gL, -1)) hooked = true; lua_pop(gL, 1); } - } - // stack is: hook_Mobj table, subtable "a", mobj - lua_remove(gL, -2); // pop subtable, leave mobj - // mobjtype subtable - // stack is: hook_Mobj table, mobj - lua_rawgeti(gL, -2, mo->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 3); // pop hook_Mobj table, mobj, and nil - // the stack should now be empty. - return false; - } - lua_remove(gL, -3); // remove hook table - // stack is: mobj, mobjtype subtable - lua_insert(gL, lua_gettop(gL)-1); // swap subtable with mobj - // stack is: mobjtype subtable, mobj + lua_pop(gL, 1); - lua_pushnil(gL); - while (lua_next(gL, -3)) { - CONS_Debug(DBG_LUA, "MobjHook: Calling hook_%s for mobj type %d\n", hookNames[which], mo->type); - lua_pushvalue(gL, -3); // mo - // stack is: mobjtype subtable, mobj, i, function, mobj - if (lua_pcall(gL, 1, 1, 0)) { - // A run-time error occurred. - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); - lua_pop(gL, 1); - // Remove this function from the hook table to prevent further errors. - lua_pushvalue(gL, -1); // key - lua_pushnil(gL); // value - lua_rawset(gL, -5); // table - CONS_Printf("Hook removed.\n"); - } - else - { - if (lua_toboolean(gL, -1)) - hooked = true; - lua_pop(gL, 1); - } - } - - lua_pop(gL, 2); // pop mobj and subtable - // the stack should now be empty. - - lua_gc(gL, LUA_GCSTEP, 3); + lua_gc(gL, LUA_GCSTEP, 1); return hooked; } boolean LUAh_PlayerHook(player_t *plr, enum hook which) { + hook_p hookp; boolean hooked = false; if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return false; - // clear the stack (just in case) lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, which); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - LUA_PushUserdata(gL, plr, META_PLAYER); - lua_pushnil(gL); - while (lua_next(gL, -3) != 0) { - lua_pushvalue(gL, -3); // player - if (lua_pcall(gL, 1, 1, 0)) { // pops hook function, player, pushes 1 return result - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == which) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) // if return true, - hooked = true; // override vanilla behavior - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, -1); + lua_pop(gL, 1); + lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -365,21 +245,22 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) // Hook for map change (before load) void LUAh_MapChange(void) { + hook_p hookp; if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8)))) return; - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MapChange); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - + lua_pop(gL, -1); lua_pushinteger(gL, gamemap); - lua_pushnil(gL); - while (lua_next(gL, -3) != 0) { - lua_pushvalue(gL, -3); // gamemap - LUA_Call(gL, 1); - } + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_MapChange) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + LUA_Call(gL, 1); + } + lua_pop(gL, 1); lua_gc(gL, LUA_GCSTEP, 1); } @@ -387,182 +268,112 @@ void LUAh_MapChange(void) // Hook for map load void LUAh_MapLoad(void) { + hook_p hookp; if (!gL || !(hooksAvailable[hook_MapLoad/8] & (1<<(hook_MapLoad%8)))) return; lua_pop(gL, -1); - - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MapLoad); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - lua_pushinteger(gL, gamemap); - lua_pushnil(gL); - while (lua_next(gL, -3) != 0) { - lua_pushvalue(gL, -3); // gamemap - LUA_Call(gL, 1); - } - lua_pop(gL, -1); - lua_gc(gL, LUA_GCCOLLECT, 0); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_MapLoad) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + LUA_Call(gL, 1); + } + + lua_pop(gL, 1); + lua_gc(gL, LUA_GCSTEP, 1); } // Hook for Got_AddPlayer void LUAh_PlayerJoin(int playernum) { + hook_p hookp; if (!gL || !(hooksAvailable[hook_PlayerJoin/8] & (1<<(hook_PlayerJoin%8)))) return; lua_pop(gL, -1); - - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_PlayerJoin); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - lua_pushinteger(gL, playernum); - lua_pushnil(gL); - while (lua_next(gL, -3) != 0) { - lua_pushvalue(gL, -3); // playernum - LUA_Call(gL, 1); - } - lua_pop(gL, -1); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_PlayerJoin) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + LUA_Call(gL, 1); + } + + lua_pop(gL, 1); lua_gc(gL, LUA_GCCOLLECT, 0); } // Hook for frame (after mobj and player thinkers) void LUAh_ThinkFrame(void) { + hook_p hookp; if (!gL || !(hooksAvailable[hook_ThinkFrame/8] & (1<<(hook_ThinkFrame%8)))) return; lua_pop(gL, -1); - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_ThinkFrame); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - lua_pushnil(gL); - while (lua_next(gL, -2) != 0) - { - //LUA_Call(gL, 0); - if (lua_pcall(gL, 0, 0, 0)) + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_ThinkFrame) { - // A run-time error occurred. - CONS_Alert(CONS_WARNING,"%s\n", lua_tostring(gL, -1)); - lua_pop(gL, 1); - // Remove this function from the hook table to prevent further errors. - lua_pushvalue(gL, -1); // key - lua_pushnil(gL); // value - lua_rawset(gL, -4); // table - CONS_Printf("Hook removed.\n"); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + if (lua_pcall(gL, 0, 0, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + } } - } - lua_pop(gL, -1); - lua_gc(gL, LUA_GCCOLLECT, 0); -} - -// Hook for PIT_CheckThing by (thing) mobj type (thing1 = thing, thing2 = tmthing) -UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2) -{ - UINT8 shouldCollide = 0; // 0 = default, 1 = force yes, 2 = force no. - if (!gL || !(hooksAvailable[hook_MobjCollide/8] & (1<<(hook_MobjCollide%8)))) - return 0; - - // clear the stack - lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MobjCollide); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // mobjtype subtable - lua_rawgeti(gL, -1, thing1->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return 0; - } - lua_remove(gL, -2); // remove hook table - - LUA_PushUserdata(gL, thing1, META_MOBJ); - LUA_PushUserdata(gL, thing2, META_MOBJ); - lua_pushnil(gL); - while (lua_next(gL, -4)) { - lua_pushvalue(gL, -4); // thing1 - lua_pushvalue(gL, -4); // thing2 - if (lua_pcall(gL, 2, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); - lua_pop(gL, 1); - continue; - } - if (!lua_isnil(gL, -1)) - { // if nil, leave shouldCollide = 0. - if (lua_toboolean(gL, -1)) - shouldCollide = 1; // Force yes - else - shouldCollide = 2; // Force no - } - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 3); // pop arguments and mobjtype table lua_gc(gL, LUA_GCSTEP, 1); - return shouldCollide; } -// Hook for PIT_CheckThing by (tmthing) mobj type (thing1 = tmthing, thing2 = thing) -UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2) +// Hook for mobj collisions +UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) { + hook_p hookp; UINT8 shouldCollide = 0; // 0 = default, 1 = force yes, 2 = force no. - if (!gL || !(hooksAvailable[hook_MobjMoveCollide/8] & (1<<(hook_MobjMoveCollide%8)))) + if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return 0; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MobjMoveCollide); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // mobjtype subtable - lua_rawgeti(gL, -1, thing1->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return 0; - } - lua_remove(gL, -2); // remove hook table - LUA_PushUserdata(gL, thing1, META_MOBJ); LUA_PushUserdata(gL, thing2, META_MOBJ); - lua_pushnil(gL); - while (lua_next(gL, -4)) { - lua_pushvalue(gL, -4); // thing1 - lua_pushvalue(gL, -4); // thing2 - if (lua_pcall(gL, 2, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == which + && (hookp->s.mt == MT_NULL || hookp->s.mt == thing1->type)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { // if nil, leave shouldCollide = 0. + if (lua_toboolean(gL, -1)) + shouldCollide = 1; // Force yes + else + shouldCollide = 2; // Force no + } lua_pop(gL, 1); - continue; } - if (!lua_isnil(gL, -1)) - { // if nil, leave shouldCollide = 0. - if (lua_toboolean(gL, -1)) - shouldCollide = 1; // Force yes - else - shouldCollide = 2; // Force no - } - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 3); // pop arguments and mobjtype table + + lua_pop(gL, 2); lua_gc(gL, LUA_GCSTEP, 1); return shouldCollide; @@ -571,47 +382,37 @@ UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2) // Hook for P_TouchSpecialThing by mobj type boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) { + hook_p hookp; boolean hooked = false; if (!gL || !(hooksAvailable[hook_TouchSpecial/8] & (1<<(hook_TouchSpecial%8)))) - return false; + return 0; - // clear the stack lua_pop(gL, -1); - - // get hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_TouchSpecial); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // get mobjtype subtable - lua_pushinteger(gL, special->type); - lua_rawget(gL, 1); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return false; - } - lua_remove(gL, 1); // pop hook table off the stack - LUA_PushUserdata(gL, special, META_MOBJ); LUA_PushUserdata(gL, toucher, META_MOBJ); - lua_pushnil(gL); - while (lua_next(gL, 1) != 0) { - lua_pushvalue(gL, 2); // special - lua_pushvalue(gL, 3); // toucher - if (lua_pcall(gL, 2, 1, 0)) { // pops hook function, special, toucher, pushes 1 return result - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_TouchSpecial + && (hookp->s.mt == MT_NULL || hookp->s.mt == special->type)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) // if return true, - hooked = true; // override vanilla behavior - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, -1); + lua_pop(gL, 2); + lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -619,53 +420,45 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) // Hook for P_DamageMobj by mobj type (Should mobj take damage?) UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) { + hook_p hookp; UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no. if (!gL || !(hooksAvailable[hook_ShouldDamage/8] & (1<<(hook_ShouldDamage%8)))) return 0; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_ShouldDamage); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // mobjtype subtable - lua_rawgeti(gL, -1, target->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return 0; - } - lua_remove(gL, -2); // remove hook table - LUA_PushUserdata(gL, target, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); lua_pushinteger(gL, damage); - lua_pushnil(gL); - while (lua_next(gL, -6)) { - lua_pushvalue(gL, -6); // target - lua_pushvalue(gL, -6); // inflictor - lua_pushvalue(gL, -6); // source - lua_pushvalue(gL, -6); // damage - if (lua_pcall(gL, 4, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_ShouldDamage + && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { + if (lua_toboolean(gL, -1)) + shouldDamage = 1; // Force yes + else + shouldDamage = 2; // Force no + } lua_pop(gL, 1); - continue; } - if (!lua_isnil(gL, -1)) - { // if nil, leave shouldDamage = 0. - if (lua_toboolean(gL, -1)) - shouldDamage = 1; // Force yes - else - shouldDamage = 2; // Force no - } - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 5); // pop arguments and mobjtype table + + lua_pop(gL, 4); lua_gc(gL, LUA_GCSTEP, 1); return shouldDamage; @@ -674,136 +467,118 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) { - boolean handled = false; + hook_p hookp; + boolean hooked = false; if (!gL || !(hooksAvailable[hook_MobjDamage/8] & (1<<(hook_MobjDamage%8)))) - return false; + return 0; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MobjDamage); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // mobjtype subtable - lua_rawgeti(gL, -1, target->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return false; - } - lua_remove(gL, -2); // remove hook table - LUA_PushUserdata(gL, target, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); lua_pushinteger(gL, damage); - lua_pushnil(gL); - while (lua_next(gL, -6)) { - lua_pushvalue(gL, -6); // target - lua_pushvalue(gL, -6); // inflictor - lua_pushvalue(gL, -6); // source - lua_pushvalue(gL, -6); // damage - if (lua_pcall(gL, 4, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDamage + && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) - handled = true; - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 5); // pop arguments and mobjtype table + + lua_pop(gL, 4); lua_gc(gL, LUA_GCSTEP, 1); - return handled; + return hooked; } // Hook for P_KillMobj by mobj type boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) { - boolean handled = false; + hook_p hookp; + boolean hooked = false; if (!gL || !(hooksAvailable[hook_MobjDeath/8] & (1<<(hook_MobjDeath%8)))) - return false; + return 0; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_MobjDeath); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // mobjtype subtable - lua_rawgeti(gL, -1, target->type); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return false; - } - lua_remove(gL, -2); // remove hook table - LUA_PushUserdata(gL, target, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); - lua_pushnil(gL); - while (lua_next(gL, -5)) { - lua_pushvalue(gL, -5); // target - lua_pushvalue(gL, -5); // inflictor - lua_pushvalue(gL, -5); // source - if (lua_pcall(gL, 3, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDeath + && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + if (lua_pcall(gL, 3, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) - handled = true; - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 4); // pop arguments and mobjtype table + + lua_pop(gL, 3); lua_gc(gL, LUA_GCSTEP, 1); - return handled; + return hooked; } // Hook for B_BuildTiccmd boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd) { + hook_p hookp; boolean hooked = false; if (!gL || !(hooksAvailable[hook_BotTiccmd/8] & (1<<(hook_BotTiccmd%8)))) return false; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_BotTiccmd); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - LUA_PushUserdata(gL, bot, META_PLAYER); LUA_PushUserdata(gL, cmd, META_TICCMD); - lua_pushnil(gL); - while (lua_next(gL, 1)) { - lua_pushvalue(gL, 2); // bot - lua_pushvalue(gL, 3); // cmd - if (lua_pcall(gL, 2, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_BotTiccmd) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) - hooked = true; - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, -1); + lua_pop(gL, 2); + lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -811,117 +586,107 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd) // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) { - if (!gL || !tails->skin || !(hooksAvailable[hook_BotAI/8] & (1<<(hook_BotAI%8)))) + hook_p hookp; + boolean hooked = false; + int n; + if (!gL || !(hooksAvailable[hook_BotAI/8] & (1<<(hook_BotAI%8)))) return false; - // clear the stack lua_pop(gL, -1); - - // hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_BotAI); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // bot skin ai function - lua_getfield(gL, 1, ((skin_t *)tails->skin)->name); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return false; - } - lua_remove(gL, 1); // pop the hook table - - // Takes sonic, tails - // Returns forward, backward, left, right, jump, spin LUA_PushUserdata(gL, sonic, META_MOBJ); LUA_PushUserdata(gL, tails, META_MOBJ); - if (lua_pcall(gL, 2, 8, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); - lua_pop(gL,-1); - return false; - } + n = lua_gettop(gL); - // This turns forward, backward, left, right, jump, and spin into a proper ticcmd for tails. - if (lua_istable(gL, 1)) { - boolean forward=false, backward=false, left=false, right=false, strafeleft=false, straferight=false, jump=false, spin=false; + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_BotAI + && (hookp->s.skinname == NULL || !strcmp(hookp->s.skinname, ((skin_t*)tails->skin)->name))) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 8, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + // This turns forward, backward, left, right, jump, and spin into a proper ticcmd for tails. + if (lua_istable(gL, n+1)) { + boolean forward=false, backward=false, left=false, right=false, strafeleft=false, straferight=false, jump=false, spin=false; #define CHECKFIELD(field) \ - lua_getfield(gL, 1, #field);\ - if (lua_toboolean(gL, -1))\ - field = true;\ - lua_pop(gL, 1); - - CHECKFIELD(forward) - CHECKFIELD(backward) - CHECKFIELD(left) - CHECKFIELD(right) - CHECKFIELD(strafeleft) - CHECKFIELD(straferight) - CHECKFIELD(jump) - CHECKFIELD(spin) + lua_getfield(gL, n+1, #field);\ + if (lua_toboolean(gL, -1))\ + field = true;\ + lua_pop(gL, 1); + CHECKFIELD(forward) + CHECKFIELD(backward) + CHECKFIELD(left) + CHECKFIELD(right) + CHECKFIELD(strafeleft) + CHECKFIELD(straferight) + CHECKFIELD(jump) + CHECKFIELD(spin) #undef CHECKFIELD + B_KeysToTiccmd(tails, cmd, forward, backward, left, right, strafeleft, straferight, jump, spin); + } else + B_KeysToTiccmd(tails, cmd, lua_toboolean(gL, n+1), lua_toboolean(gL, n+2), lua_toboolean(gL, n+3), lua_toboolean(gL, n+4), lua_toboolean(gL, n+5), lua_toboolean(gL, n+6), lua_toboolean(gL, n+7), lua_toboolean(gL, n+8)); - B_KeysToTiccmd(tails, cmd, forward, backward, left, right, strafeleft, straferight, jump, spin); - } else - B_KeysToTiccmd(tails, cmd, lua_toboolean(gL, 1), lua_toboolean(gL, 2), lua_toboolean(gL, 3), lua_toboolean(gL, 4), lua_toboolean(gL, 5), lua_toboolean(gL, 6), lua_toboolean(gL, 7), lua_toboolean(gL, 8)); + lua_pop(gL, 8); + hooked = true; + } + + lua_pop(gL, 2); - lua_pop(gL, -1); lua_gc(gL, LUA_GCSTEP, 1); - return true; + return hooked; } // Hook for linedef executors boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) { + hook_p hookp; + boolean hooked = false; if (!gL || !(hooksAvailable[hook_LinedefExecute/8] & (1<<(hook_LinedefExecute%8)))) - return false; + return 0; - // clear the stack lua_pop(gL, -1); - - // get hook table - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_LinedefExecute); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - // get function by line text - lua_getfield(gL, 1, line->text); - if (lua_isnil(gL, -1)) { - lua_pop(gL, 2); - return false; - } - lua_remove(gL, 1); // pop hook table off the stack - LUA_PushUserdata(gL, line, META_LINE); LUA_PushUserdata(gL, mo, META_MOBJ); LUA_PushUserdata(gL, sector, META_SECTOR); - LUA_Call(gL, 3); // pops hook function, line, mo, sector - lua_pop(gL, -1); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_LinedefExecute + && !strcmp(hookp->s.funcname, line->text)) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + LUA_Call(gL, 3); + hooked = true; + } + + lua_pop(gL, 3); + lua_gc(gL, LUA_GCSTEP, 1); - return true; + return hooked; } -// Hook for PlayerMsg -Red +// Hook for player chat boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) { - boolean handled = false; - + hook_p hookp; + boolean hooked = false; if (!gL || !(hooksAvailable[hook_PlayerMsg/8] & (1<<(hook_PlayerMsg%8)))) return false; - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_PlayerMsg); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - + lua_pop(gL, -1); LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player - if (flags & 2 /*HU_CSAY*/) { // csay TODO: make HU_CSAY accessible outside hu_stuff.c lua_pushinteger(gL, 3); // type lua_pushnil(gL); // target @@ -935,70 +700,73 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) lua_pushinteger(gL, 2); // type LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target } - lua_pushstring(gL, msg); // msg - lua_pushnil(gL); - - while (lua_next(gL, -6)) { - lua_pushvalue(gL, -6); // source - lua_pushvalue(gL, -6); // type - lua_pushvalue(gL, -6); // target - lua_pushvalue(gL, -6); // msg - if (lua_pcall(gL, 4, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_PlayerMsg) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) - handled = true; - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 4); // pop arguments and mobjtype table + + lua_pop(gL, 4); lua_gc(gL, LUA_GCSTEP, 1); - return handled; + return hooked; } -// Hook for hurt messages -Red -// The internal name is DeathMsg, but the API name is "HurtMsg". Keep that in mind. (Should this be fixed at some point?) -// @TODO This hook should be fixed to take mobj type at the addHook parameter to compare to inflictor. (I couldn't get this to work without crashing) -boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source) +// Hook for hurt messages +boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) { - boolean handled = false; - - if (!gL || !(hooksAvailable[hook_DeathMsg/8] & (1<<(hook_DeathMsg%8)))) + hook_p hookp; + boolean hooked = false; + if (!gL || !(hooksAvailable[hook_HurtMsg/8] & (1<<(hook_HurtMsg%8)))) return false; - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_DeathMsg); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); + lua_pop(gL, -1); + LUA_PushUserdata(gL, player, META_PLAYER); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); - LUA_PushUserdata(gL, player, META_PLAYER); // Player - LUA_PushUserdata(gL, inflictor, META_MOBJ); // Inflictor - LUA_PushUserdata(gL, source, META_MOBJ); // Source - - lua_pushnil(gL); - - while (lua_next(gL, -5)) { - lua_pushvalue(gL, -5); // player - lua_pushvalue(gL, -5); // inflictor - lua_pushvalue(gL, -5); // source - if (lua_pcall(gL, 3, 1, 0)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_HurtMsg + && (hookp->s.mt == MT_NULL || (inflictor && hookp->s.mt == inflictor->type))) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + if (lua_pcall(gL, 3, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; lua_pop(gL, 1); - continue; } - if (lua_toboolean(gL, -1)) - handled = true; - lua_pop(gL, 1); // pop return value - } - lua_pop(gL, 3); // pop arguments and mobjtype table + + lua_pop(gL, 3); lua_gc(gL, LUA_GCSTEP, 1); - return handled; + return hooked; } #endif diff --git a/src/p_inter.c b/src/p_inter.c index 8eaa4765a..478bd459c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1478,7 +1478,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour return; // Presumably it's obvious what's happening in splitscreen. #ifdef HAVE_BLUA - if (LUAh_DeathMsg(player, inflictor, source)) + if (LUAh_HurtMsg(player, inflictor, source)) return; #endif From 120c9c5ad50d800924062697da6848d0764e8999 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 07:41:44 -0400 Subject: [PATCH 20/30] Change int32_t to __int32 on MSC. I can't just say screw it and include the full doomtype.h here (windows.h conflict?) so a small hack here will have to do. :I --- src/blua/luaconf.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/blua/luaconf.h b/src/blua/luaconf.h index 4a8a41723..9e2948f41 100644 --- a/src/blua/luaconf.h +++ b/src/blua/luaconf.h @@ -10,7 +10,13 @@ #include #include + +#ifdef _MSC_VER +#define INT32 __int32 +#else #include +#define INT32 int32_t +#endif /* @@ -141,7 +147,7 @@ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ -#define LUA_INTEGER int32_t +#define LUA_INTEGER INT32 /* @@ -503,13 +509,13 @@ */ //#define LUA_NUMBER_DOUBLE -#define LUA_NUMBER int32_t +#define LUA_NUMBER INT32 /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ -#define LUAI_UACNUMBER int32_t +#define LUAI_UACNUMBER INT32 /* From 6ac5013802eaad2e3856d75331cedf9a950d3c38 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 08:06:16 -0400 Subject: [PATCH 21/30] Only push userdata to the stack when needed!! Dummy, what do you think you're doing? If you just push mobjs and players into Lua all willy- nilly everywhere, you'll wind up generating tons of metatables and stuff you arne't even gonna use! Oh. Thanks me, I'm really smart. --- src/lua_hooklib.c | 198 +++++++++++++++++++++++++--------------------- 1 file changed, 107 insertions(+), 91 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index c314ed045..d0c64d792 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -180,13 +180,14 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, mo, META_MOBJ); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == which && (hookp->s.mt == MT_NULL || hookp->s.mt == mo->type)) { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, mo, META_MOBJ); lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -2); @@ -202,8 +203,7 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) lua_pop(gL, 1); } - lua_pop(gL, 1); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -215,12 +215,13 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, plr, META_PLAYER); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == which) { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, plr, META_PLAYER); lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -2); @@ -236,8 +237,7 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) lua_pop(gL, 1); } - lua_pop(gL, 1); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -249,7 +249,7 @@ void LUAh_MapChange(void) if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8)))) return; - lua_pop(gL, -1); + lua_settop(gL, 0); lua_pushinteger(gL, gamemap); for (hookp = roothook; hookp; hookp = hookp->next) @@ -261,7 +261,7 @@ void LUAh_MapChange(void) LUA_Call(gL, 1); } - lua_pop(gL, 1); + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); } @@ -272,7 +272,7 @@ void LUAh_MapLoad(void) if (!gL || !(hooksAvailable[hook_MapLoad/8] & (1<<(hook_MapLoad%8)))) return; - lua_pop(gL, -1); + lua_settop(gL, 0); lua_pushinteger(gL, gamemap); for (hookp = roothook; hookp; hookp = hookp->next) @@ -284,7 +284,7 @@ void LUAh_MapLoad(void) LUA_Call(gL, 1); } - lua_pop(gL, 1); + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); } @@ -295,7 +295,7 @@ void LUAh_PlayerJoin(int playernum) if (!gL || !(hooksAvailable[hook_PlayerJoin/8] & (1<<(hook_PlayerJoin%8)))) return; - lua_pop(gL, -1); + lua_settop(gL, 0); lua_pushinteger(gL, playernum); for (hookp = roothook; hookp; hookp = hookp->next) @@ -307,7 +307,7 @@ void LUAh_PlayerJoin(int playernum) LUA_Call(gL, 1); } - lua_pop(gL, 1); + lua_settop(gL, 0); lua_gc(gL, LUA_GCCOLLECT, 0); } @@ -318,8 +318,6 @@ void LUAh_ThinkFrame(void) if (!gL || !(hooksAvailable[hook_ThinkFrame/8] & (1<<(hook_ThinkFrame%8)))) return; - lua_pop(gL, -1); - for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_ThinkFrame) { @@ -344,14 +342,17 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, thing1, META_MOBJ); - LUA_PushUserdata(gL, thing2, META_MOBJ); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == which && (hookp->s.mt == MT_NULL || hookp->s.mt == thing1->type)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, thing1, META_MOBJ); + LUA_PushUserdata(gL, thing2, META_MOBJ); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -3); @@ -373,8 +374,7 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) lua_pop(gL, 1); } - lua_pop(gL, 2); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return shouldCollide; } @@ -387,14 +387,17 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) if (!gL || !(hooksAvailable[hook_TouchSpecial/8] & (1<<(hook_TouchSpecial%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, special, META_MOBJ); - LUA_PushUserdata(gL, toucher, META_MOBJ); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_TouchSpecial && (hookp->s.mt == MT_NULL || hookp->s.mt == special->type)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, special, META_MOBJ); + LUA_PushUserdata(gL, toucher, META_MOBJ); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -3); @@ -411,8 +414,7 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) lua_pop(gL, 1); } - lua_pop(gL, 2); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -425,16 +427,19 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 if (!gL || !(hooksAvailable[hook_ShouldDamage/8] & (1<<(hook_ShouldDamage%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, target, META_MOBJ); - LUA_PushUserdata(gL, inflictor, META_MOBJ); - LUA_PushUserdata(gL, source, META_MOBJ); - lua_pushinteger(gL, damage); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_ShouldDamage && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damage); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -5); @@ -458,8 +463,7 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 lua_pop(gL, 1); } - lua_pop(gL, 4); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return shouldDamage; } @@ -472,16 +476,19 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 if (!gL || !(hooksAvailable[hook_MobjDamage/8] & (1<<(hook_MobjDamage%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, target, META_MOBJ); - LUA_PushUserdata(gL, inflictor, META_MOBJ); - LUA_PushUserdata(gL, source, META_MOBJ); - lua_pushinteger(gL, damage); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_MobjDamage && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damage); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -5); @@ -500,8 +507,7 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 lua_pop(gL, 1); } - lua_pop(gL, 4); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -514,15 +520,18 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) if (!gL || !(hooksAvailable[hook_MobjDeath/8] & (1<<(hook_MobjDeath%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, target, META_MOBJ); - LUA_PushUserdata(gL, inflictor, META_MOBJ); - LUA_PushUserdata(gL, source, META_MOBJ); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_MobjDeath && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -4); @@ -540,8 +549,7 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) lua_pop(gL, 1); } - lua_pop(gL, 3); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -554,13 +562,16 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd) if (!gL || !(hooksAvailable[hook_BotTiccmd/8] & (1<<(hook_BotTiccmd%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, bot, META_PLAYER); - LUA_PushUserdata(gL, cmd, META_TICCMD); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_BotTiccmd) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, bot, META_PLAYER); + LUA_PushUserdata(gL, cmd, META_TICCMD); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -3); @@ -577,8 +588,7 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd) lua_pop(gL, 1); } - lua_pop(gL, 2); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -588,19 +598,20 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) { hook_p hookp; boolean hooked = false; - int n; if (!gL || !(hooksAvailable[hook_BotAI/8] & (1<<(hook_BotAI%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, sonic, META_MOBJ); - LUA_PushUserdata(gL, tails, META_MOBJ); - n = lua_gettop(gL); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_BotAI && (hookp->s.skinname == NULL || !strcmp(hookp->s.skinname, ((skin_t*)tails->skin)->name))) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, sonic, META_MOBJ); + LUA_PushUserdata(gL, tails, META_MOBJ); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -3); @@ -614,10 +625,10 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) } // This turns forward, backward, left, right, jump, and spin into a proper ticcmd for tails. - if (lua_istable(gL, n+1)) { + if (lua_istable(gL, 2+1)) { boolean forward=false, backward=false, left=false, right=false, strafeleft=false, straferight=false, jump=false, spin=false; #define CHECKFIELD(field) \ - lua_getfield(gL, n+1, #field);\ + lua_getfield(gL, 2+1, #field);\ if (lua_toboolean(gL, -1))\ field = true;\ lua_pop(gL, 1); @@ -633,14 +644,13 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) #undef CHECKFIELD B_KeysToTiccmd(tails, cmd, forward, backward, left, right, strafeleft, straferight, jump, spin); } else - B_KeysToTiccmd(tails, cmd, lua_toboolean(gL, n+1), lua_toboolean(gL, n+2), lua_toboolean(gL, n+3), lua_toboolean(gL, n+4), lua_toboolean(gL, n+5), lua_toboolean(gL, n+6), lua_toboolean(gL, n+7), lua_toboolean(gL, n+8)); + B_KeysToTiccmd(tails, cmd, lua_toboolean(gL, 2+1), lua_toboolean(gL, 2+2), lua_toboolean(gL, 2+3), lua_toboolean(gL, 2+4), lua_toboolean(gL, 2+5), lua_toboolean(gL, 2+6), lua_toboolean(gL, 2+7), lua_toboolean(gL, 2+8)); lua_pop(gL, 8); hooked = true; } - lua_pop(gL, 2); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -653,15 +663,18 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) if (!gL || !(hooksAvailable[hook_LinedefExecute/8] & (1<<(hook_LinedefExecute%8)))) return 0; - lua_pop(gL, -1); - LUA_PushUserdata(gL, line, META_LINE); - LUA_PushUserdata(gL, mo, META_MOBJ); - LUA_PushUserdata(gL, sector, META_SECTOR); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_LinedefExecute && !strcmp(hookp->s.funcname, line->text)) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, line, META_LINE); + LUA_PushUserdata(gL, mo, META_MOBJ); + LUA_PushUserdata(gL, sector, META_SECTOR); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -4); @@ -671,8 +684,7 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) hooked = true; } - lua_pop(gL, 3); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -685,26 +697,29 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) if (!gL || !(hooksAvailable[hook_PlayerMsg/8] & (1<<(hook_PlayerMsg%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player - if (flags & 2 /*HU_CSAY*/) { // csay TODO: make HU_CSAY accessible outside hu_stuff.c - lua_pushinteger(gL, 3); // type - lua_pushnil(gL); // target - } else if (target == -1) { // sayteam - lua_pushinteger(gL, 1); // type - lua_pushnil(gL); // target - } else if (target == 0) { // say - lua_pushinteger(gL, 0); // type - lua_pushnil(gL); // target - } else { // sayto - lua_pushinteger(gL, 2); // type - LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target - } - lua_pushstring(gL, msg); // msg + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_PlayerMsg) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player + if (flags & 2 /*HU_CSAY*/) { // csay TODO: make HU_CSAY accessible outside hu_stuff.c + lua_pushinteger(gL, 3); // type + lua_pushnil(gL); // target + } else if (target == -1) { // sayteam + lua_pushinteger(gL, 1); // type + lua_pushnil(gL); // target + } else if (target == 0) { // say + lua_pushinteger(gL, 0); // type + lua_pushnil(gL); // target + } else { // sayto + lua_pushinteger(gL, 2); // type + LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target + } + lua_pushstring(gL, msg); // msg + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -5); @@ -723,8 +738,7 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) lua_pop(gL, 1); } - lua_pop(gL, 4); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -737,15 +751,18 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) if (!gL || !(hooksAvailable[hook_HurtMsg/8] & (1<<(hook_HurtMsg%8)))) return false; - lua_pop(gL, -1); - LUA_PushUserdata(gL, player, META_PLAYER); - LUA_PushUserdata(gL, inflictor, META_MOBJ); - LUA_PushUserdata(gL, source, META_MOBJ); + lua_settop(gL, 0); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_HurtMsg && (hookp->s.mt == MT_NULL || (inflictor && hookp->s.mt == inflictor->type))) { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, player, META_PLAYER); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); lua_pushvalue(gL, -4); @@ -763,8 +780,7 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) lua_pop(gL, 1); } - lua_pop(gL, 3); - + lua_settop(gL, 0); lua_gc(gL, LUA_GCSTEP, 1); return hooked; } From 06b82d172b8dee1257713f3e42ad2daa5a72f7c3 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 11:06:56 -0400 Subject: [PATCH 22/30] lua_pushfstring only allows %d not %x Stupid JTE. --- src/lua_hooklib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index d0c64d792..52c218000 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -71,7 +71,7 @@ struct hook_s }; typedef struct hook_s* hook_p; -#define FMT_HOOKID "hook_%04x" +#define FMT_HOOKID "hook_%d" hook_p roothook; From c139e93fe64b9433f08a1ae4f3b9622727bac4bf Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 12:07:08 -0400 Subject: [PATCH 23/30] Applied new finesine table. finesine[0] == 0 now. This naturally fixes a bunch of math fudging. No ill effects have been observed so far. --- src/tables.c | 2548 +++++++++++++++++++++++++------------------------- 1 file changed, 1274 insertions(+), 1274 deletions(-) diff --git a/src/tables.c b/src/tables.c index fa71effef..190522a35 100644 --- a/src/tables.c +++ b/src/tables.c @@ -679,1284 +679,1284 @@ fixed_t finetangent[4096] = fixed_t finesine[10240] = { - 25, 75, 125, 175, 226, 276, 326, 376, - 427, 477, 527, 578, 628, 678, 728, 779, - 829, 879, 929, 980, 1030, 1080, 1130, 1181, - 1231, 1281, 1331, 1382, 1432, 1482, 1532, 1583, - 1633, 1683, 1733, 1784, 1834, 1884, 1934, 1985, - 2035, 2085, 2135, 2186, 2236, 2286, 2336, 2387, - 2437, 2487, 2537, 2587, 2638, 2688, 2738, 2788, - 2839, 2889, 2939, 2989, 3039, 3090, 3140, 3190, - 3240, 3291, 3341, 3391, 3441, 3491, 3541, 3592, - 3642, 3692, 3742, 3792, 3843, 3893, 3943, 3993, - 4043, 4093, 4144, 4194, 4244, 4294, 4344, 4394, - 4445, 4495, 4545, 4595, 4645, 4695, 4745, 4796, - 4846, 4896, 4946, 4996, 5046, 5096, 5146, 5197, - 5247, 5297, 5347, 5397, 5447, 5497, 5547, 5597, - 5647, 5697, 5748, 5798, 5848, 5898, 5948, 5998, - 6048, 6098, 6148, 6198, 6248, 6298, 6348, 6398, - 6448, 6498, 6548, 6598, 6648, 6698, 6748, 6798, - 6848, 6898, 6948, 6998, 7048, 7098, 7148, 7198, - 7248, 7298, 7348, 7398, 7448, 7498, 7548, 7598, - 7648, 7697, 7747, 7797, 7847, 7897, 7947, 7997, - 8047, 8097, 8147, 8196, 8246, 8296, 8346, 8396, - 8446, 8496, 8545, 8595, 8645, 8695, 8745, 8794, - 8844, 8894, 8944, 8994, 9043, 9093, 9143, 9193, - 9243, 9292, 9342, 9392, 9442, 9491, 9541, 9591, - 9640, 9690, 9740, 9790, 9839, 9889, 9939, 9988, - 10038, 10088, 10137, 10187, 10237, 10286, 10336, 10386, - 10435, 10485, 10534, 10584, 10634, 10683, 10733, 10782, - 10832, 10882, 10931, 10981, 11030, 11080, 11129, 11179, - 11228, 11278, 11327, 11377, 11426, 11476, 11525, 11575, - 11624, 11674, 11723, 11773, 11822, 11872, 11921, 11970, - 12020, 12069, 12119, 12168, 12218, 12267, 12316, 12366, - 12415, 12464, 12514, 12563, 12612, 12662, 12711, 12760, - 12810, 12859, 12908, 12957, 13007, 13056, 13105, 13154, - 13204, 13253, 13302, 13351, 13401, 13450, 13499, 13548, - 13597, 13647, 13696, 13745, 13794, 13843, 13892, 13941, - 13990, 14040, 14089, 14138, 14187, 14236, 14285, 14334, - 14383, 14432, 14481, 14530, 14579, 14628, 14677, 14726, - 14775, 14824, 14873, 14922, 14971, 15020, 15069, 15118, - 15167, 15215, 15264, 15313, 15362, 15411, 15460, 15509, - 15557, 15606, 15655, 15704, 15753, 15802, 15850, 15899, - 15948, 15997, 16045, 16094, 16143, 16191, 16240, 16289, - 16338, 16386, 16435, 16484, 16532, 16581, 16629, 16678, - 16727, 16775, 16824, 16872, 16921, 16970, 17018, 17067, - 17115, 17164, 17212, 17261, 17309, 17358, 17406, 17455, - 17503, 17551, 17600, 17648, 17697, 17745, 17793, 17842, - 17890, 17939, 17987, 18035, 18084, 18132, 18180, 18228, - 18277, 18325, 18373, 18421, 18470, 18518, 18566, 18614, - 18663, 18711, 18759, 18807, 18855, 18903, 18951, 19000, - 19048, 19096, 19144, 19192, 19240, 19288, 19336, 19384, - 19432, 19480, 19528, 19576, 19624, 19672, 19720, 19768, - 19816, 19864, 19912, 19959, 20007, 20055, 20103, 20151, - 20199, 20246, 20294, 20342, 20390, 20438, 20485, 20533, - 20581, 20629, 20676, 20724, 20772, 20819, 20867, 20915, - 20962, 21010, 21057, 21105, 21153, 21200, 21248, 21295, - 21343, 21390, 21438, 21485, 21533, 21580, 21628, 21675, - 21723, 21770, 21817, 21865, 21912, 21960, 22007, 22054, - 22102, 22149, 22196, 22243, 22291, 22338, 22385, 22433, - 22480, 22527, 22574, 22621, 22668, 22716, 22763, 22810, - 22857, 22904, 22951, 22998, 23045, 23092, 23139, 23186, - 23233, 23280, 23327, 23374, 23421, 23468, 23515, 23562, - 23609, 23656, 23703, 23750, 23796, 23843, 23890, 23937, - 23984, 24030, 24077, 24124, 24171, 24217, 24264, 24311, - 24357, 24404, 24451, 24497, 24544, 24591, 24637, 24684, - 24730, 24777, 24823, 24870, 24916, 24963, 25009, 25056, - 25102, 25149, 25195, 25241, 25288, 25334, 25381, 25427, - 25473, 25520, 25566, 25612, 25658, 25705, 25751, 25797, - 25843, 25889, 25936, 25982, 26028, 26074, 26120, 26166, - 26212, 26258, 26304, 26350, 26396, 26442, 26488, 26534, - 26580, 26626, 26672, 26718, 26764, 26810, 26856, 26902, - 26947, 26993, 27039, 27085, 27131, 27176, 27222, 27268, - 27313, 27359, 27405, 27450, 27496, 27542, 27587, 27633, - 27678, 27724, 27770, 27815, 27861, 27906, 27952, 27997, - 28042, 28088, 28133, 28179, 28224, 28269, 28315, 28360, - 28405, 28451, 28496, 28541, 28586, 28632, 28677, 28722, - 28767, 28812, 28858, 28903, 28948, 28993, 29038, 29083, - 29128, 29173, 29218, 29263, 29308, 29353, 29398, 29443, - 29488, 29533, 29577, 29622, 29667, 29712, 29757, 29801, - 29846, 29891, 29936, 29980, 30025, 30070, 30114, 30159, - 30204, 30248, 30293, 30337, 30382, 30426, 30471, 30515, - 30560, 30604, 30649, 30693, 30738, 30782, 30826, 30871, - 30915, 30959, 31004, 31048, 31092, 31136, 31181, 31225, - 31269, 31313, 31357, 31402, 31446, 31490, 31534, 31578, - 31622, 31666, 31710, 31754, 31798, 31842, 31886, 31930, - 31974, 32017, 32061, 32105, 32149, 32193, 32236, 32280, - 32324, 32368, 32411, 32455, 32499, 32542, 32586, 32630, - 32673, 32717, 32760, 32804, 32847, 32891, 32934, 32978, - 33021, 33065, 33108, 33151, 33195, 33238, 33281, 33325, - 33368, 33411, 33454, 33498, 33541, 33584, 33627, 33670, - 33713, 33756, 33799, 33843, 33886, 33929, 33972, 34015, - 34057, 34100, 34143, 34186, 34229, 34272, 34315, 34358, - 34400, 34443, 34486, 34529, 34571, 34614, 34657, 34699, - 34742, 34785, 34827, 34870, 34912, 34955, 34997, 35040, - 35082, 35125, 35167, 35210, 35252, 35294, 35337, 35379, - 35421, 35464, 35506, 35548, 35590, 35633, 35675, 35717, - 35759, 35801, 35843, 35885, 35927, 35969, 36011, 36053, - 36095, 36137, 36179, 36221, 36263, 36305, 36347, 36388, - 36430, 36472, 36514, 36555, 36597, 36639, 36681, 36722, - 36764, 36805, 36847, 36889, 36930, 36972, 37013, 37055, - 37096, 37137, 37179, 37220, 37262, 37303, 37344, 37386, - 37427, 37468, 37509, 37551, 37592, 37633, 37674, 37715, - 37756, 37797, 37838, 37879, 37920, 37961, 38002, 38043, - 38084, 38125, 38166, 38207, 38248, 38288, 38329, 38370, - 38411, 38451, 38492, 38533, 38573, 38614, 38655, 38695, - 38736, 38776, 38817, 38857, 38898, 38938, 38979, 39019, - 39059, 39100, 39140, 39180, 39221, 39261, 39301, 39341, - 39382, 39422, 39462, 39502, 39542, 39582, 39622, 39662, - 39702, 39742, 39782, 39822, 39862, 39902, 39942, 39982, - 40021, 40061, 40101, 40141, 40180, 40220, 40260, 40300, - 40339, 40379, 40418, 40458, 40497, 40537, 40576, 40616, - 40655, 40695, 40734, 40773, 40813, 40852, 40891, 40931, - 40970, 41009, 41048, 41087, 41127, 41166, 41205, 41244, - 41283, 41322, 41361, 41400, 41439, 41478, 41517, 41556, - 41595, 41633, 41672, 41711, 41750, 41788, 41827, 41866, - 41904, 41943, 41982, 42020, 42059, 42097, 42136, 42174, - 42213, 42251, 42290, 42328, 42366, 42405, 42443, 42481, - 42520, 42558, 42596, 42634, 42672, 42711, 42749, 42787, - 42825, 42863, 42901, 42939, 42977, 43015, 43053, 43091, - 43128, 43166, 43204, 43242, 43280, 43317, 43355, 43393, - 43430, 43468, 43506, 43543, 43581, 43618, 43656, 43693, - 43731, 43768, 43806, 43843, 43880, 43918, 43955, 43992, - 44029, 44067, 44104, 44141, 44178, 44215, 44252, 44289, - 44326, 44363, 44400, 44437, 44474, 44511, 44548, 44585, - 44622, 44659, 44695, 44732, 44769, 44806, 44842, 44879, - 44915, 44952, 44989, 45025, 45062, 45098, 45135, 45171, - 45207, 45244, 45280, 45316, 45353, 45389, 45425, 45462, - 45498, 45534, 45570, 45606, 45642, 45678, 45714, 45750, - 45786, 45822, 45858, 45894, 45930, 45966, 46002, 46037, - 46073, 46109, 46145, 46180, 46216, 46252, 46287, 46323, - 46358, 46394, 46429, 46465, 46500, 46536, 46571, 46606, - 46642, 46677, 46712, 46747, 46783, 46818, 46853, 46888, - 46923, 46958, 46993, 47028, 47063, 47098, 47133, 47168, - 47203, 47238, 47273, 47308, 47342, 47377, 47412, 47446, - 47481, 47516, 47550, 47585, 47619, 47654, 47688, 47723, - 47757, 47792, 47826, 47860, 47895, 47929, 47963, 47998, - 48032, 48066, 48100, 48134, 48168, 48202, 48237, 48271, - 48305, 48338, 48372, 48406, 48440, 48474, 48508, 48542, - 48575, 48609, 48643, 48676, 48710, 48744, 48777, 48811, - 48844, 48878, 48911, 48945, 48978, 49012, 49045, 49078, - 49112, 49145, 49178, 49211, 49244, 49278, 49311, 49344, - 49377, 49410, 49443, 49476, 49509, 49542, 49575, 49608, - 49640, 49673, 49706, 49739, 49771, 49804, 49837, 49869, - 49902, 49935, 49967, 50000, 50032, 50065, 50097, 50129, - 50162, 50194, 50226, 50259, 50291, 50323, 50355, 50387, - 50420, 50452, 50484, 50516, 50548, 50580, 50612, 50644, - 50675, 50707, 50739, 50771, 50803, 50834, 50866, 50898, - 50929, 50961, 50993, 51024, 51056, 51087, 51119, 51150, - 51182, 51213, 51244, 51276, 51307, 51338, 51369, 51401, - 51432, 51463, 51494, 51525, 51556, 51587, 51618, 51649, - 51680, 51711, 51742, 51773, 51803, 51834, 51865, 51896, - 51926, 51957, 51988, 52018, 52049, 52079, 52110, 52140, - 52171, 52201, 52231, 52262, 52292, 52322, 52353, 52383, - 52413, 52443, 52473, 52503, 52534, 52564, 52594, 52624, - 52653, 52683, 52713, 52743, 52773, 52803, 52832, 52862, - 52892, 52922, 52951, 52981, 53010, 53040, 53069, 53099, - 53128, 53158, 53187, 53216, 53246, 53275, 53304, 53334, - 53363, 53392, 53421, 53450, 53479, 53508, 53537, 53566, - 53595, 53624, 53653, 53682, 53711, 53739, 53768, 53797, - 53826, 53854, 53883, 53911, 53940, 53969, 53997, 54026, - 54054, 54082, 54111, 54139, 54167, 54196, 54224, 54252, - 54280, 54308, 54337, 54365, 54393, 54421, 54449, 54477, - 54505, 54533, 54560, 54588, 54616, 54644, 54672, 54699, - 54727, 54755, 54782, 54810, 54837, 54865, 54892, 54920, - 54947, 54974, 55002, 55029, 55056, 55084, 55111, 55138, - 55165, 55192, 55219, 55246, 55274, 55300, 55327, 55354, - 55381, 55408, 55435, 55462, 55489, 55515, 55542, 55569, - 55595, 55622, 55648, 55675, 55701, 55728, 55754, 55781, - 55807, 55833, 55860, 55886, 55912, 55938, 55965, 55991, - 56017, 56043, 56069, 56095, 56121, 56147, 56173, 56199, - 56225, 56250, 56276, 56302, 56328, 56353, 56379, 56404, - 56430, 56456, 56481, 56507, 56532, 56557, 56583, 56608, - 56633, 56659, 56684, 56709, 56734, 56760, 56785, 56810, - 56835, 56860, 56885, 56910, 56935, 56959, 56984, 57009, - 57034, 57059, 57083, 57108, 57133, 57157, 57182, 57206, - 57231, 57255, 57280, 57304, 57329, 57353, 57377, 57402, - 57426, 57450, 57474, 57498, 57522, 57546, 57570, 57594, - 57618, 57642, 57666, 57690, 57714, 57738, 57762, 57785, - 57809, 57833, 57856, 57880, 57903, 57927, 57950, 57974, - 57997, 58021, 58044, 58067, 58091, 58114, 58137, 58160, - 58183, 58207, 58230, 58253, 58276, 58299, 58322, 58345, - 58367, 58390, 58413, 58436, 58459, 58481, 58504, 58527, - 58549, 58572, 58594, 58617, 58639, 58662, 58684, 58706, - 58729, 58751, 58773, 58795, 58818, 58840, 58862, 58884, - 58906, 58928, 58950, 58972, 58994, 59016, 59038, 59059, - 59081, 59103, 59125, 59146, 59168, 59190, 59211, 59233, - 59254, 59276, 59297, 59318, 59340, 59361, 59382, 59404, - 59425, 59446, 59467, 59488, 59509, 59530, 59551, 59572, - 59593, 59614, 59635, 59656, 59677, 59697, 59718, 59739, - 59759, 59780, 59801, 59821, 59842, 59862, 59883, 59903, - 59923, 59944, 59964, 59984, 60004, 60025, 60045, 60065, - 60085, 60105, 60125, 60145, 60165, 60185, 60205, 60225, - 60244, 60264, 60284, 60304, 60323, 60343, 60363, 60382, - 60402, 60421, 60441, 60460, 60479, 60499, 60518, 60537, - 60556, 60576, 60595, 60614, 60633, 60652, 60671, 60690, - 60709, 60728, 60747, 60766, 60785, 60803, 60822, 60841, - 60859, 60878, 60897, 60915, 60934, 60952, 60971, 60989, - 61007, 61026, 61044, 61062, 61081, 61099, 61117, 61135, - 61153, 61171, 61189, 61207, 61225, 61243, 61261, 61279, - 61297, 61314, 61332, 61350, 61367, 61385, 61403, 61420, - 61438, 61455, 61473, 61490, 61507, 61525, 61542, 61559, - 61577, 61594, 61611, 61628, 61645, 61662, 61679, 61696, - 61713, 61730, 61747, 61764, 61780, 61797, 61814, 61831, - 61847, 61864, 61880, 61897, 61913, 61930, 61946, 61963, - 61979, 61995, 62012, 62028, 62044, 62060, 62076, 62092, - 62108, 62125, 62141, 62156, 62172, 62188, 62204, 62220, - 62236, 62251, 62267, 62283, 62298, 62314, 62329, 62345, - 62360, 62376, 62391, 62407, 62422, 62437, 62453, 62468, - 62483, 62498, 62513, 62528, 62543, 62558, 62573, 62588, - 62603, 62618, 62633, 62648, 62662, 62677, 62692, 62706, - 62721, 62735, 62750, 62764, 62779, 62793, 62808, 62822, - 62836, 62850, 62865, 62879, 62893, 62907, 62921, 62935, - 62949, 62963, 62977, 62991, 63005, 63019, 63032, 63046, - 63060, 63074, 63087, 63101, 63114, 63128, 63141, 63155, - 63168, 63182, 63195, 63208, 63221, 63235, 63248, 63261, - 63274, 63287, 63300, 63313, 63326, 63339, 63352, 63365, - 63378, 63390, 63403, 63416, 63429, 63441, 63454, 63466, - 63479, 63491, 63504, 63516, 63528, 63541, 63553, 63565, - 63578, 63590, 63602, 63614, 63626, 63638, 63650, 63662, - 63674, 63686, 63698, 63709, 63721, 63733, 63745, 63756, - 63768, 63779, 63791, 63803, 63814, 63825, 63837, 63848, - 63859, 63871, 63882, 63893, 63904, 63915, 63927, 63938, - 63949, 63960, 63971, 63981, 63992, 64003, 64014, 64025, - 64035, 64046, 64057, 64067, 64078, 64088, 64099, 64109, - 64120, 64130, 64140, 64151, 64161, 64171, 64181, 64192, - 64202, 64212, 64222, 64232, 64242, 64252, 64261, 64271, - 64281, 64291, 64301, 64310, 64320, 64330, 64339, 64349, - 64358, 64368, 64377, 64387, 64396, 64405, 64414, 64424, - 64433, 64442, 64451, 64460, 64469, 64478, 64487, 64496, - 64505, 64514, 64523, 64532, 64540, 64549, 64558, 64566, - 64575, 64584, 64592, 64601, 64609, 64617, 64626, 64634, - 64642, 64651, 64659, 64667, 64675, 64683, 64691, 64699, - 64707, 64715, 64723, 64731, 64739, 64747, 64754, 64762, - 64770, 64777, 64785, 64793, 64800, 64808, 64815, 64822, - 64830, 64837, 64844, 64852, 64859, 64866, 64873, 64880, - 64887, 64895, 64902, 64908, 64915, 64922, 64929, 64936, - 64943, 64949, 64956, 64963, 64969, 64976, 64982, 64989, - 64995, 65002, 65008, 65015, 65021, 65027, 65033, 65040, - 65046, 65052, 65058, 65064, 65070, 65076, 65082, 65088, - 65094, 65099, 65105, 65111, 65117, 65122, 65128, 65133, - 65139, 65144, 65150, 65155, 65161, 65166, 65171, 65177, - 65182, 65187, 65192, 65197, 65202, 65207, 65212, 65217, - 65222, 65227, 65232, 65237, 65242, 65246, 65251, 65256, - 65260, 65265, 65270, 65274, 65279, 65283, 65287, 65292, - 65296, 65300, 65305, 65309, 65313, 65317, 65321, 65325, - 65329, 65333, 65337, 65341, 65345, 65349, 65352, 65356, - 65360, 65363, 65367, 65371, 65374, 65378, 65381, 65385, - 65388, 65391, 65395, 65398, 65401, 65404, 65408, 65411, - 65414, 65417, 65420, 65423, 65426, 65429, 65431, 65434, - 65437, 65440, 65442, 65445, 65448, 65450, 65453, 65455, - 65458, 65460, 65463, 65465, 65467, 65470, 65472, 65474, - 65476, 65478, 65480, 65482, 65484, 65486, 65488, 65490, - 65492, 65494, 65496, 65497, 65499, 65501, 65502, 65504, - 65505, 65507, 65508, 65510, 65511, 65513, 65514, 65515, - 65516, 65518, 65519, 65520, 65521, 65522, 65523, 65524, - 65525, 65526, 65527, 65527, 65528, 65529, 65530, 65530, + 0, 50, 100, 150, 201, 251, 301, 351, + 402, 452, 502, 552, 603, 653, 703, 753, + 804, 854, 904, 955, 1005, 1055, 1105, 1156, + 1206, 1256, 1306, 1357, 1407, 1457, 1507, 1558, + 1608, 1658, 1708, 1759, 1809, 1859, 1909, 1960, + 2010, 2060, 2110, 2161, 2211, 2261, 2311, 2361, + 2412, 2462, 2512, 2562, 2613, 2663, 2713, 2763, + 2814, 2864, 2914, 2964, 3014, 3065, 3115, 3165, + 3215, 3265, 3316, 3366, 3416, 3466, 3516, 3567, + 3617, 3667, 3717, 3767, 3818, 3868, 3918, 3968, + 4018, 4068, 4119, 4169, 4219, 4269, 4319, 4369, + 4420, 4470, 4520, 4570, 4620, 4670, 4720, 4770, + 4821, 4871, 4921, 4971, 5021, 5071, 5121, 5171, + 5222, 5272, 5322, 5372, 5422, 5472, 5522, 5572, + 5622, 5672, 5722, 5773, 5823, 5873, 5923, 5973, + 6023, 6073, 6123, 6173, 6223, 6273, 6323, 6373, + 6423, 6473, 6523, 6573, 6623, 6673, 6723, 6773, + 6823, 6873, 6923, 6973, 7023, 7073, 7123, 7173, + 7223, 7273, 7323, 7373, 7423, 7473, 7523, 7573, + 7623, 7672, 7722, 7772, 7822, 7872, 7922, 7972, + 8022, 8072, 8122, 8171, 8221, 8271, 8321, 8371, + 8421, 8471, 8520, 8570, 8620, 8670, 8720, 8770, + 8819, 8869, 8919, 8969, 9019, 9068, 9118, 9168, + 9218, 9267, 9317, 9367, 9417, 9466, 9516, 9566, + 9616, 9665, 9715, 9765, 9814, 9864, 9914, 9964, + 10013, 10063, 10113, 10162, 10212, 10262, 10311, 10361, + 10410, 10460, 10510, 10559, 10609, 10658, 10708, 10758, + 10807, 10857, 10906, 10956, 11006, 11055, 11105, 11154, + 11204, 11253, 11303, 11352, 11402, 11451, 11501, 11550, + 11600, 11649, 11699, 11748, 11797, 11847, 11896, 11946, + 11995, 12045, 12094, 12143, 12193, 12242, 12292, 12341, + 12390, 12440, 12489, 12538, 12588, 12637, 12686, 12736, + 12785, 12834, 12884, 12933, 12982, 13031, 13081, 13130, + 13179, 13228, 13278, 13327, 13376, 13425, 13474, 13524, + 13573, 13622, 13671, 13720, 13769, 13819, 13868, 13917, + 13966, 14015, 14064, 14113, 14162, 14211, 14260, 14309, + 14359, 14408, 14457, 14506, 14555, 14604, 14653, 14702, + 14751, 14800, 14849, 14897, 14946, 14995, 15044, 15093, + 15142, 15191, 15240, 15289, 15338, 15387, 15435, 15484, + 15533, 15582, 15631, 15680, 15728, 15777, 15826, 15875, + 15923, 15972, 16021, 16070, 16118, 16167, 16216, 16265, + 16313, 16362, 16411, 16459, 16508, 16557, 16605, 16654, + 16702, 16751, 16800, 16848, 16897, 16945, 16994, 17042, + 17091, 17139, 17188, 17236, 17285, 17333, 17382, 17430, + 17479, 17527, 17576, 17624, 17672, 17721, 17769, 17818, + 17866, 17914, 17963, 18011, 18059, 18108, 18156, 18204, + 18253, 18301, 18349, 18397, 18446, 18494, 18542, 18590, + 18638, 18687, 18735, 18783, 18831, 18879, 18927, 18975, + 19024, 19072, 19120, 19168, 19216, 19264, 19312, 19360, + 19408, 19456, 19504, 19552, 19600, 19648, 19696, 19744, + 19792, 19840, 19888, 19935, 19983, 20031, 20079, 20127, + 20175, 20223, 20270, 20318, 20366, 20414, 20461, 20509, + 20557, 20605, 20652, 20700, 20748, 20795, 20843, 20891, + 20938, 20986, 21034, 21081, 21129, 21176, 21224, 21271, + 21319, 21367, 21414, 21462, 21509, 21557, 21604, 21651, + 21699, 21746, 21794, 21841, 21889, 21936, 21983, 22031, + 22078, 22125, 22173, 22220, 22267, 22314, 22362, 22409, + 22456, 22503, 22551, 22598, 22645, 22692, 22739, 22786, + 22833, 22881, 22928, 22975, 23022, 23069, 23116, 23163, + 23210, 23257, 23304, 23351, 23398, 23445, 23492, 23539, + 23586, 23632, 23679, 23726, 23773, 23820, 23867, 23914, + 23960, 24007, 24054, 24101, 24147, 24194, 24241, 24287, + 24334, 24381, 24427, 24474, 24521, 24567, 24614, 24660, + 24707, 24754, 24800, 24847, 24893, 24940, 24986, 25033, + 25079, 25125, 25172, 25218, 25265, 25311, 25357, 25404, + 25450, 25496, 25543, 25589, 25635, 25681, 25728, 25774, + 25820, 25866, 25913, 25959, 26005, 26051, 26097, 26143, + 26189, 26235, 26281, 26327, 26373, 26419, 26465, 26511, + 26557, 26603, 26649, 26695, 26741, 26787, 26833, 26879, + 26925, 26970, 27016, 27062, 27108, 27153, 27199, 27245, + 27291, 27336, 27382, 27428, 27473, 27519, 27565, 27610, + 27656, 27701, 27747, 27792, 27838, 27883, 27929, 27974, + 28020, 28065, 28111, 28156, 28201, 28247, 28292, 28337, + 28383, 28428, 28473, 28519, 28564, 28609, 28654, 28699, + 28745, 28790, 28835, 28880, 28925, 28970, 29015, 29060, + 29105, 29151, 29196, 29241, 29285, 29330, 29375, 29420, + 29465, 29510, 29555, 29600, 29645, 29690, 29734, 29779, + 29824, 29869, 29913, 29958, 30003, 30047, 30092, 30137, + 30181, 30226, 30271, 30315, 30360, 30404, 30449, 30493, + 30538, 30582, 30627, 30671, 30715, 30760, 30804, 30849, + 30893, 30937, 30982, 31026, 31070, 31114, 31159, 31203, + 31247, 31291, 31335, 31379, 31424, 31468, 31512, 31556, + 31600, 31644, 31688, 31732, 31776, 31820, 31864, 31908, + 31952, 31995, 32039, 32083, 32127, 32171, 32215, 32258, + 32302, 32346, 32390, 32433, 32477, 32521, 32564, 32608, + 32651, 32695, 32738, 32782, 32826, 32869, 32912, 32956, + 32999, 33043, 33086, 33130, 33173, 33216, 33260, 33303, + 33346, 33389, 33433, 33476, 33519, 33562, 33605, 33649, + 33692, 33735, 33778, 33821, 33864, 33907, 33950, 33993, + 34036, 34079, 34122, 34165, 34208, 34251, 34293, 34336, + 34379, 34422, 34465, 34507, 34550, 34593, 34635, 34678, + 34721, 34763, 34806, 34849, 34891, 34934, 34976, 35019, + 35061, 35104, 35146, 35188, 35231, 35273, 35316, 35358, + 35400, 35442, 35485, 35527, 35569, 35611, 35654, 35696, + 35738, 35780, 35822, 35864, 35906, 35948, 35990, 36032, + 36074, 36116, 36158, 36200, 36242, 36284, 36326, 36368, + 36409, 36451, 36493, 36535, 36576, 36618, 36660, 36701, + 36743, 36785, 36826, 36868, 36909, 36951, 36992, 37034, + 37075, 37117, 37158, 37200, 37241, 37282, 37324, 37365, + 37406, 37447, 37489, 37530, 37571, 37612, 37653, 37695, + 37736, 37777, 37818, 37859, 37900, 37941, 37982, 38023, + 38064, 38105, 38146, 38186, 38227, 38268, 38309, 38350, + 38390, 38431, 38472, 38512, 38553, 38594, 38634, 38675, + 38716, 38756, 38797, 38837, 38878, 38918, 38958, 38999, + 39039, 39080, 39120, 39160, 39201, 39241, 39281, 39321, + 39362, 39402, 39442, 39482, 39522, 39562, 39602, 39642, + 39682, 39722, 39762, 39802, 39842, 39882, 39922, 39962, + 40002, 40041, 40081, 40121, 40161, 40200, 40240, 40280, + 40319, 40359, 40399, 40438, 40478, 40517, 40557, 40596, + 40636, 40675, 40714, 40754, 40793, 40832, 40872, 40911, + 40950, 40990, 41029, 41068, 41107, 41146, 41185, 41224, + 41263, 41303, 41342, 41381, 41419, 41458, 41497, 41536, + 41575, 41614, 41653, 41692, 41730, 41769, 41808, 41846, + 41885, 41924, 41962, 42001, 42040, 42078, 42117, 42155, + 42194, 42232, 42271, 42309, 42347, 42386, 42424, 42462, + 42501, 42539, 42577, 42615, 42653, 42692, 42730, 42768, + 42806, 42844, 42882, 42920, 42958, 42996, 43034, 43072, + 43110, 43147, 43185, 43223, 43261, 43298, 43336, 43374, + 43412, 43449, 43487, 43524, 43562, 43600, 43637, 43675, + 43712, 43749, 43787, 43824, 43862, 43899, 43936, 43974, + 44011, 44048, 44085, 44122, 44160, 44197, 44234, 44271, + 44308, 44345, 44382, 44419, 44456, 44493, 44530, 44567, + 44603, 44640, 44677, 44714, 44750, 44787, 44824, 44861, + 44897, 44934, 44970, 45007, 45043, 45080, 45116, 45153, + 45189, 45226, 45262, 45298, 45335, 45371, 45407, 45443, + 45480, 45516, 45552, 45588, 45624, 45660, 45696, 45732, + 45768, 45804, 45840, 45876, 45912, 45948, 45984, 46019, + 46055, 46091, 46127, 46162, 46198, 46234, 46269, 46305, + 46340, 46376, 46411, 46447, 46482, 46518, 46553, 46589, + 46624, 46659, 46695, 46730, 46765, 46800, 46835, 46871, + 46906, 46941, 46976, 47011, 47046, 47081, 47116, 47151, + 47186, 47220, 47255, 47290, 47325, 47360, 47394, 47429, + 47464, 47498, 47533, 47568, 47602, 47637, 47671, 47706, + 47740, 47775, 47809, 47843, 47878, 47912, 47946, 47981, + 48015, 48049, 48083, 48117, 48151, 48185, 48219, 48254, + 48288, 48321, 48355, 48389, 48423, 48457, 48491, 48525, + 48558, 48592, 48626, 48660, 48693, 48727, 48760, 48794, + 48828, 48861, 48895, 48928, 48961, 48995, 49028, 49062, + 49095, 49128, 49161, 49195, 49228, 49261, 49294, 49327, + 49360, 49393, 49426, 49459, 49492, 49525, 49558, 49591, + 49624, 49657, 49690, 49722, 49755, 49788, 49820, 49853, + 49886, 49918, 49951, 49983, 50016, 50048, 50081, 50113, + 50146, 50178, 50210, 50242, 50275, 50307, 50339, 50371, + 50403, 50436, 50468, 50500, 50532, 50564, 50596, 50628, + 50660, 50691, 50723, 50755, 50787, 50819, 50850, 50882, + 50914, 50945, 50977, 51008, 51040, 51072, 51103, 51134, + 51166, 51197, 51229, 51260, 51291, 51323, 51354, 51385, + 51416, 51447, 51478, 51510, 51541, 51572, 51603, 51634, + 51665, 51695, 51726, 51757, 51788, 51819, 51850, 51880, + 51911, 51942, 51972, 52003, 52033, 52064, 52095, 52125, + 52155, 52186, 52216, 52247, 52277, 52307, 52338, 52368, + 52398, 52428, 52458, 52488, 52518, 52549, 52579, 52609, + 52639, 52668, 52698, 52728, 52758, 52788, 52818, 52847, + 52877, 52907, 52936, 52966, 52996, 53025, 53055, 53084, + 53114, 53143, 53172, 53202, 53231, 53260, 53290, 53319, + 53348, 53377, 53407, 53436, 53465, 53494, 53523, 53552, + 53581, 53610, 53639, 53667, 53696, 53725, 53754, 53783, + 53811, 53840, 53869, 53897, 53926, 53954, 53983, 54011, + 54040, 54068, 54097, 54125, 54153, 54182, 54210, 54238, + 54266, 54294, 54323, 54351, 54379, 54407, 54435, 54463, + 54491, 54519, 54546, 54574, 54602, 54630, 54658, 54685, + 54713, 54741, 54768, 54796, 54823, 54851, 54879, 54906, + 54933, 54961, 54988, 55015, 55043, 55070, 55097, 55124, + 55152, 55179, 55206, 55233, 55260, 55287, 55314, 55341, + 55368, 55395, 55422, 55448, 55475, 55502, 55529, 55555, + 55582, 55609, 55635, 55662, 55688, 55715, 55741, 55768, + 55794, 55820, 55847, 55873, 55899, 55925, 55952, 55978, + 56004, 56030, 56056, 56082, 56108, 56134, 56160, 56186, + 56212, 56237, 56263, 56289, 56315, 56340, 56366, 56392, + 56417, 56443, 56468, 56494, 56519, 56545, 56570, 56595, + 56621, 56646, 56671, 56697, 56722, 56747, 56772, 56797, + 56822, 56847, 56872, 56897, 56922, 56947, 56972, 56997, + 57022, 57046, 57071, 57096, 57120, 57145, 57170, 57194, + 57219, 57243, 57268, 57292, 57316, 57341, 57365, 57389, + 57414, 57438, 57462, 57486, 57510, 57534, 57558, 57582, + 57606, 57630, 57654, 57678, 57702, 57726, 57750, 57773, + 57797, 57821, 57844, 57868, 57892, 57915, 57939, 57962, + 57986, 58009, 58032, 58056, 58079, 58102, 58125, 58149, + 58172, 58195, 58218, 58241, 58264, 58287, 58310, 58333, + 58356, 58379, 58402, 58424, 58447, 58470, 58493, 58515, + 58538, 58560, 58583, 58605, 58628, 58650, 58673, 58695, + 58718, 58740, 58762, 58784, 58807, 58829, 58851, 58873, + 58895, 58917, 58939, 58961, 58983, 59005, 59027, 59049, + 59070, 59092, 59114, 59135, 59157, 59179, 59200, 59222, + 59243, 59265, 59286, 59308, 59329, 59350, 59372, 59393, + 59414, 59435, 59457, 59478, 59499, 59520, 59541, 59562, + 59583, 59604, 59625, 59645, 59666, 59687, 59708, 59728, + 59749, 59770, 59790, 59811, 59831, 59852, 59872, 59893, + 59913, 59934, 59954, 59974, 59994, 60015, 60035, 60055, + 60075, 60095, 60115, 60135, 60155, 60175, 60195, 60215, + 60235, 60254, 60274, 60294, 60313, 60333, 60353, 60372, + 60392, 60411, 60431, 60450, 60470, 60489, 60508, 60528, + 60547, 60566, 60585, 60604, 60624, 60643, 60662, 60681, + 60700, 60719, 60737, 60756, 60775, 60794, 60813, 60831, + 60850, 60869, 60887, 60906, 60924, 60943, 60961, 60980, + 60998, 61017, 61035, 61053, 61071, 61090, 61108, 61126, + 61144, 61162, 61180, 61198, 61216, 61234, 61252, 61270, + 61288, 61305, 61323, 61341, 61359, 61376, 61394, 61411, + 61429, 61446, 61464, 61481, 61499, 61516, 61533, 61551, + 61568, 61585, 61602, 61619, 61637, 61654, 61671, 61688, + 61705, 61721, 61738, 61755, 61772, 61789, 61805, 61822, + 61839, 61855, 61872, 61889, 61905, 61922, 61938, 61954, + 61971, 61987, 62003, 62020, 62036, 62052, 62068, 62084, + 62100, 62117, 62133, 62148, 62164, 62180, 62196, 62212, + 62228, 62244, 62259, 62275, 62291, 62306, 62322, 62337, + 62353, 62368, 62384, 62399, 62414, 62430, 62445, 62460, + 62475, 62491, 62506, 62521, 62536, 62551, 62566, 62581, + 62596, 62610, 62625, 62640, 62655, 62670, 62684, 62699, + 62714, 62728, 62743, 62757, 62772, 62786, 62800, 62815, + 62829, 62843, 62858, 62872, 62886, 62900, 62914, 62928, + 62942, 62956, 62970, 62984, 62998, 63012, 63026, 63039, + 63053, 63067, 63080, 63094, 63108, 63121, 63135, 63148, + 63162, 63175, 63188, 63202, 63215, 63228, 63241, 63254, + 63268, 63281, 63294, 63307, 63320, 63333, 63346, 63358, + 63371, 63384, 63397, 63410, 63422, 63435, 63447, 63460, + 63473, 63485, 63498, 63510, 63522, 63535, 63547, 63559, + 63571, 63584, 63596, 63608, 63620, 63632, 63644, 63656, + 63668, 63680, 63692, 63704, 63715, 63727, 63739, 63750, + 63762, 63774, 63785, 63797, 63808, 63820, 63831, 63842, + 63854, 63865, 63876, 63888, 63899, 63910, 63921, 63932, + 63943, 63954, 63965, 63976, 63987, 63998, 64009, 64019, + 64030, 64041, 64051, 64062, 64073, 64083, 64094, 64104, + 64115, 64125, 64135, 64146, 64156, 64166, 64176, 64186, + 64197, 64207, 64217, 64227, 64237, 64247, 64257, 64266, + 64276, 64286, 64296, 64305, 64315, 64325, 64334, 64344, + 64353, 64363, 64372, 64382, 64391, 64401, 64410, 64419, + 64428, 64437, 64447, 64456, 64465, 64474, 64483, 64492, + 64501, 64510, 64518, 64527, 64536, 64545, 64553, 64562, + 64571, 64579, 64588, 64596, 64605, 64613, 64622, 64630, + 64638, 64646, 64655, 64663, 64671, 64679, 64687, 64695, + 64703, 64711, 64719, 64727, 64735, 64743, 64751, 64758, + 64766, 64774, 64781, 64789, 64796, 64804, 64811, 64819, + 64826, 64834, 64841, 64848, 64855, 64863, 64870, 64877, + 64884, 64891, 64898, 64905, 64912, 64919, 64926, 64933, + 64939, 64946, 64953, 64959, 64966, 64973, 64979, 64986, + 64992, 64999, 65005, 65011, 65018, 65024, 65030, 65036, + 65043, 65049, 65055, 65061, 65067, 65073, 65079, 65085, + 65091, 65096, 65102, 65108, 65114, 65119, 65125, 65131, + 65136, 65142, 65147, 65153, 65158, 65163, 65169, 65174, + 65179, 65184, 65190, 65195, 65200, 65205, 65210, 65215, + 65220, 65225, 65230, 65235, 65239, 65244, 65249, 65253, + 65258, 65263, 65267, 65272, 65276, 65281, 65285, 65290, + 65294, 65298, 65302, 65307, 65311, 65315, 65319, 65323, + 65327, 65331, 65335, 65339, 65343, 65347, 65350, 65354, + 65358, 65362, 65365, 65369, 65372, 65376, 65379, 65383, + 65386, 65390, 65393, 65396, 65400, 65403, 65406, 65409, + 65412, 65415, 65418, 65421, 65424, 65427, 65430, 65433, + 65436, 65438, 65441, 65444, 65446, 65449, 65452, 65454, + 65457, 65459, 65461, 65464, 65466, 65468, 65471, 65473, + 65475, 65477, 65479, 65481, 65483, 65485, 65487, 65489, + 65491, 65493, 65495, 65496, 65498, 65500, 65501, 65503, + 65505, 65506, 65508, 65509, 65511, 65512, 65513, 65515, + 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, + 65524, 65525, 65526, 65527, 65528, 65529, 65529, 65530, 65531, 65531, 65532, 65532, 65533, 65533, 65534, 65534, 65534, 65535, 65535, 65535, 65535, 65535, 65535, 65535, - 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65534, - 65534, 65534, 65533, 65533, 65532, 65532, 65531, 65531, - 65530, 65530, 65529, 65528, 65527, 65527, 65526, 65525, - 65524, 65523, 65522, 65521, 65520, 65519, 65518, 65516, - 65515, 65514, 65513, 65511, 65510, 65508, 65507, 65505, - 65504, 65502, 65501, 65499, 65497, 65496, 65494, 65492, - 65490, 65488, 65486, 65484, 65482, 65480, 65478, 65476, - 65474, 65472, 65470, 65467, 65465, 65463, 65460, 65458, - 65455, 65453, 65450, 65448, 65445, 65442, 65440, 65437, - 65434, 65431, 65429, 65426, 65423, 65420, 65417, 65414, - 65411, 65408, 65404, 65401, 65398, 65395, 65391, 65388, - 65385, 65381, 65378, 65374, 65371, 65367, 65363, 65360, - 65356, 65352, 65349, 65345, 65341, 65337, 65333, 65329, - 65325, 65321, 65317, 65313, 65309, 65305, 65300, 65296, - 65292, 65287, 65283, 65279, 65274, 65270, 65265, 65260, - 65256, 65251, 65246, 65242, 65237, 65232, 65227, 65222, - 65217, 65212, 65207, 65202, 65197, 65192, 65187, 65182, - 65177, 65171, 65166, 65161, 65155, 65150, 65144, 65139, - 65133, 65128, 65122, 65117, 65111, 65105, 65099, 65094, - 65088, 65082, 65076, 65070, 65064, 65058, 65052, 65046, - 65040, 65033, 65027, 65021, 65015, 65008, 65002, 64995, - 64989, 64982, 64976, 64969, 64963, 64956, 64949, 64943, - 64936, 64929, 64922, 64915, 64908, 64902, 64895, 64887, - 64880, 64873, 64866, 64859, 64852, 64844, 64837, 64830, - 64822, 64815, 64808, 64800, 64793, 64785, 64777, 64770, - 64762, 64754, 64747, 64739, 64731, 64723, 64715, 64707, - 64699, 64691, 64683, 64675, 64667, 64659, 64651, 64642, - 64634, 64626, 64617, 64609, 64600, 64592, 64584, 64575, - 64566, 64558, 64549, 64540, 64532, 64523, 64514, 64505, - 64496, 64487, 64478, 64469, 64460, 64451, 64442, 64433, - 64424, 64414, 64405, 64396, 64387, 64377, 64368, 64358, - 64349, 64339, 64330, 64320, 64310, 64301, 64291, 64281, - 64271, 64261, 64252, 64242, 64232, 64222, 64212, 64202, - 64192, 64181, 64171, 64161, 64151, 64140, 64130, 64120, - 64109, 64099, 64088, 64078, 64067, 64057, 64046, 64035, - 64025, 64014, 64003, 63992, 63981, 63971, 63960, 63949, - 63938, 63927, 63915, 63904, 63893, 63882, 63871, 63859, - 63848, 63837, 63825, 63814, 63803, 63791, 63779, 63768, - 63756, 63745, 63733, 63721, 63709, 63698, 63686, 63674, - 63662, 63650, 63638, 63626, 63614, 63602, 63590, 63578, - 63565, 63553, 63541, 63528, 63516, 63504, 63491, 63479, - 63466, 63454, 63441, 63429, 63416, 63403, 63390, 63378, - 63365, 63352, 63339, 63326, 63313, 63300, 63287, 63274, - 63261, 63248, 63235, 63221, 63208, 63195, 63182, 63168, - 63155, 63141, 63128, 63114, 63101, 63087, 63074, 63060, - 63046, 63032, 63019, 63005, 62991, 62977, 62963, 62949, - 62935, 62921, 62907, 62893, 62879, 62865, 62850, 62836, - 62822, 62808, 62793, 62779, 62764, 62750, 62735, 62721, - 62706, 62692, 62677, 62662, 62648, 62633, 62618, 62603, - 62588, 62573, 62558, 62543, 62528, 62513, 62498, 62483, - 62468, 62453, 62437, 62422, 62407, 62391, 62376, 62360, - 62345, 62329, 62314, 62298, 62283, 62267, 62251, 62236, - 62220, 62204, 62188, 62172, 62156, 62141, 62125, 62108, - 62092, 62076, 62060, 62044, 62028, 62012, 61995, 61979, - 61963, 61946, 61930, 61913, 61897, 61880, 61864, 61847, - 61831, 61814, 61797, 61780, 61764, 61747, 61730, 61713, - 61696, 61679, 61662, 61645, 61628, 61611, 61594, 61577, - 61559, 61542, 61525, 61507, 61490, 61473, 61455, 61438, - 61420, 61403, 61385, 61367, 61350, 61332, 61314, 61297, - 61279, 61261, 61243, 61225, 61207, 61189, 61171, 61153, - 61135, 61117, 61099, 61081, 61062, 61044, 61026, 61007, - 60989, 60971, 60952, 60934, 60915, 60897, 60878, 60859, - 60841, 60822, 60803, 60785, 60766, 60747, 60728, 60709, - 60690, 60671, 60652, 60633, 60614, 60595, 60576, 60556, - 60537, 60518, 60499, 60479, 60460, 60441, 60421, 60402, - 60382, 60363, 60343, 60323, 60304, 60284, 60264, 60244, - 60225, 60205, 60185, 60165, 60145, 60125, 60105, 60085, - 60065, 60045, 60025, 60004, 59984, 59964, 59944, 59923, - 59903, 59883, 59862, 59842, 59821, 59801, 59780, 59759, - 59739, 59718, 59697, 59677, 59656, 59635, 59614, 59593, - 59572, 59551, 59530, 59509, 59488, 59467, 59446, 59425, - 59404, 59382, 59361, 59340, 59318, 59297, 59276, 59254, - 59233, 59211, 59190, 59168, 59146, 59125, 59103, 59081, - 59059, 59038, 59016, 58994, 58972, 58950, 58928, 58906, - 58884, 58862, 58840, 58818, 58795, 58773, 58751, 58729, - 58706, 58684, 58662, 58639, 58617, 58594, 58572, 58549, - 58527, 58504, 58481, 58459, 58436, 58413, 58390, 58367, - 58345, 58322, 58299, 58276, 58253, 58230, 58207, 58183, - 58160, 58137, 58114, 58091, 58067, 58044, 58021, 57997, - 57974, 57950, 57927, 57903, 57880, 57856, 57833, 57809, - 57785, 57762, 57738, 57714, 57690, 57666, 57642, 57618, - 57594, 57570, 57546, 57522, 57498, 57474, 57450, 57426, - 57402, 57377, 57353, 57329, 57304, 57280, 57255, 57231, - 57206, 57182, 57157, 57133, 57108, 57083, 57059, 57034, - 57009, 56984, 56959, 56935, 56910, 56885, 56860, 56835, - 56810, 56785, 56760, 56734, 56709, 56684, 56659, 56633, - 56608, 56583, 56557, 56532, 56507, 56481, 56456, 56430, - 56404, 56379, 56353, 56328, 56302, 56276, 56250, 56225, - 56199, 56173, 56147, 56121, 56095, 56069, 56043, 56017, - 55991, 55965, 55938, 55912, 55886, 55860, 55833, 55807, - 55781, 55754, 55728, 55701, 55675, 55648, 55622, 55595, - 55569, 55542, 55515, 55489, 55462, 55435, 55408, 55381, - 55354, 55327, 55300, 55274, 55246, 55219, 55192, 55165, - 55138, 55111, 55084, 55056, 55029, 55002, 54974, 54947, - 54920, 54892, 54865, 54837, 54810, 54782, 54755, 54727, - 54699, 54672, 54644, 54616, 54588, 54560, 54533, 54505, - 54477, 54449, 54421, 54393, 54365, 54337, 54308, 54280, - 54252, 54224, 54196, 54167, 54139, 54111, 54082, 54054, - 54026, 53997, 53969, 53940, 53911, 53883, 53854, 53826, - 53797, 53768, 53739, 53711, 53682, 53653, 53624, 53595, - 53566, 53537, 53508, 53479, 53450, 53421, 53392, 53363, - 53334, 53304, 53275, 53246, 53216, 53187, 53158, 53128, - 53099, 53069, 53040, 53010, 52981, 52951, 52922, 52892, - 52862, 52832, 52803, 52773, 52743, 52713, 52683, 52653, - 52624, 52594, 52564, 52534, 52503, 52473, 52443, 52413, - 52383, 52353, 52322, 52292, 52262, 52231, 52201, 52171, - 52140, 52110, 52079, 52049, 52018, 51988, 51957, 51926, - 51896, 51865, 51834, 51803, 51773, 51742, 51711, 51680, - 51649, 51618, 51587, 51556, 51525, 51494, 51463, 51432, - 51401, 51369, 51338, 51307, 51276, 51244, 51213, 51182, - 51150, 51119, 51087, 51056, 51024, 50993, 50961, 50929, - 50898, 50866, 50834, 50803, 50771, 50739, 50707, 50675, - 50644, 50612, 50580, 50548, 50516, 50484, 50452, 50420, - 50387, 50355, 50323, 50291, 50259, 50226, 50194, 50162, - 50129, 50097, 50065, 50032, 50000, 49967, 49935, 49902, - 49869, 49837, 49804, 49771, 49739, 49706, 49673, 49640, - 49608, 49575, 49542, 49509, 49476, 49443, 49410, 49377, - 49344, 49311, 49278, 49244, 49211, 49178, 49145, 49112, - 49078, 49045, 49012, 48978, 48945, 48911, 48878, 48844, - 48811, 48777, 48744, 48710, 48676, 48643, 48609, 48575, - 48542, 48508, 48474, 48440, 48406, 48372, 48338, 48304, - 48271, 48237, 48202, 48168, 48134, 48100, 48066, 48032, - 47998, 47963, 47929, 47895, 47860, 47826, 47792, 47757, - 47723, 47688, 47654, 47619, 47585, 47550, 47516, 47481, - 47446, 47412, 47377, 47342, 47308, 47273, 47238, 47203, - 47168, 47133, 47098, 47063, 47028, 46993, 46958, 46923, - 46888, 46853, 46818, 46783, 46747, 46712, 46677, 46642, - 46606, 46571, 46536, 46500, 46465, 46429, 46394, 46358, - 46323, 46287, 46252, 46216, 46180, 46145, 46109, 46073, - 46037, 46002, 45966, 45930, 45894, 45858, 45822, 45786, - 45750, 45714, 45678, 45642, 45606, 45570, 45534, 45498, - 45462, 45425, 45389, 45353, 45316, 45280, 45244, 45207, - 45171, 45135, 45098, 45062, 45025, 44989, 44952, 44915, - 44879, 44842, 44806, 44769, 44732, 44695, 44659, 44622, - 44585, 44548, 44511, 44474, 44437, 44400, 44363, 44326, - 44289, 44252, 44215, 44178, 44141, 44104, 44067, 44029, - 43992, 43955, 43918, 43880, 43843, 43806, 43768, 43731, - 43693, 43656, 43618, 43581, 43543, 43506, 43468, 43430, - 43393, 43355, 43317, 43280, 43242, 43204, 43166, 43128, - 43091, 43053, 43015, 42977, 42939, 42901, 42863, 42825, - 42787, 42749, 42711, 42672, 42634, 42596, 42558, 42520, - 42481, 42443, 42405, 42366, 42328, 42290, 42251, 42213, - 42174, 42136, 42097, 42059, 42020, 41982, 41943, 41904, - 41866, 41827, 41788, 41750, 41711, 41672, 41633, 41595, - 41556, 41517, 41478, 41439, 41400, 41361, 41322, 41283, - 41244, 41205, 41166, 41127, 41088, 41048, 41009, 40970, - 40931, 40891, 40852, 40813, 40773, 40734, 40695, 40655, - 40616, 40576, 40537, 40497, 40458, 40418, 40379, 40339, - 40300, 40260, 40220, 40180, 40141, 40101, 40061, 40021, - 39982, 39942, 39902, 39862, 39822, 39782, 39742, 39702, - 39662, 39622, 39582, 39542, 39502, 39462, 39422, 39382, - 39341, 39301, 39261, 39221, 39180, 39140, 39100, 39059, - 39019, 38979, 38938, 38898, 38857, 38817, 38776, 38736, - 38695, 38655, 38614, 38573, 38533, 38492, 38451, 38411, - 38370, 38329, 38288, 38248, 38207, 38166, 38125, 38084, - 38043, 38002, 37961, 37920, 37879, 37838, 37797, 37756, - 37715, 37674, 37633, 37592, 37551, 37509, 37468, 37427, - 37386, 37344, 37303, 37262, 37220, 37179, 37137, 37096, - 37055, 37013, 36972, 36930, 36889, 36847, 36805, 36764, - 36722, 36681, 36639, 36597, 36556, 36514, 36472, 36430, - 36388, 36347, 36305, 36263, 36221, 36179, 36137, 36095, - 36053, 36011, 35969, 35927, 35885, 35843, 35801, 35759, - 35717, 35675, 35633, 35590, 35548, 35506, 35464, 35421, - 35379, 35337, 35294, 35252, 35210, 35167, 35125, 35082, - 35040, 34997, 34955, 34912, 34870, 34827, 34785, 34742, - 34699, 34657, 34614, 34571, 34529, 34486, 34443, 34400, - 34358, 34315, 34272, 34229, 34186, 34143, 34100, 34057, - 34015, 33972, 33929, 33886, 33843, 33799, 33756, 33713, - 33670, 33627, 33584, 33541, 33498, 33454, 33411, 33368, - 33325, 33281, 33238, 33195, 33151, 33108, 33065, 33021, - 32978, 32934, 32891, 32847, 32804, 32760, 32717, 32673, - 32630, 32586, 32542, 32499, 32455, 32411, 32368, 32324, - 32280, 32236, 32193, 32149, 32105, 32061, 32017, 31974, - 31930, 31886, 31842, 31798, 31754, 31710, 31666, 31622, - 31578, 31534, 31490, 31446, 31402, 31357, 31313, 31269, - 31225, 31181, 31136, 31092, 31048, 31004, 30959, 30915, - 30871, 30826, 30782, 30738, 30693, 30649, 30604, 30560, - 30515, 30471, 30426, 30382, 30337, 30293, 30248, 30204, - 30159, 30114, 30070, 30025, 29980, 29936, 29891, 29846, - 29801, 29757, 29712, 29667, 29622, 29577, 29533, 29488, - 29443, 29398, 29353, 29308, 29263, 29218, 29173, 29128, - 29083, 29038, 28993, 28948, 28903, 28858, 28812, 28767, - 28722, 28677, 28632, 28586, 28541, 28496, 28451, 28405, - 28360, 28315, 28269, 28224, 28179, 28133, 28088, 28042, - 27997, 27952, 27906, 27861, 27815, 27770, 27724, 27678, - 27633, 27587, 27542, 27496, 27450, 27405, 27359, 27313, - 27268, 27222, 27176, 27131, 27085, 27039, 26993, 26947, - 26902, 26856, 26810, 26764, 26718, 26672, 26626, 26580, - 26534, 26488, 26442, 26396, 26350, 26304, 26258, 26212, - 26166, 26120, 26074, 26028, 25982, 25936, 25889, 25843, - 25797, 25751, 25705, 25658, 25612, 25566, 25520, 25473, - 25427, 25381, 25334, 25288, 25241, 25195, 25149, 25102, - 25056, 25009, 24963, 24916, 24870, 24823, 24777, 24730, - 24684, 24637, 24591, 24544, 24497, 24451, 24404, 24357, - 24311, 24264, 24217, 24171, 24124, 24077, 24030, 23984, - 23937, 23890, 23843, 23796, 23750, 23703, 23656, 23609, - 23562, 23515, 23468, 23421, 23374, 23327, 23280, 23233, - 23186, 23139, 23092, 23045, 22998, 22951, 22904, 22857, - 22810, 22763, 22716, 22668, 22621, 22574, 22527, 22480, - 22433, 22385, 22338, 22291, 22243, 22196, 22149, 22102, - 22054, 22007, 21960, 21912, 21865, 21817, 21770, 21723, - 21675, 21628, 21580, 21533, 21485, 21438, 21390, 21343, - 21295, 21248, 21200, 21153, 21105, 21057, 21010, 20962, - 20915, 20867, 20819, 20772, 20724, 20676, 20629, 20581, - 20533, 20485, 20438, 20390, 20342, 20294, 20246, 20199, - 20151, 20103, 20055, 20007, 19959, 19912, 19864, 19816, - 19768, 19720, 19672, 19624, 19576, 19528, 19480, 19432, - 19384, 19336, 19288, 19240, 19192, 19144, 19096, 19048, - 19000, 18951, 18903, 18855, 18807, 18759, 18711, 18663, - 18614, 18566, 18518, 18470, 18421, 18373, 18325, 18277, - 18228, 18180, 18132, 18084, 18035, 17987, 17939, 17890, - 17842, 17793, 17745, 17697, 17648, 17600, 17551, 17503, - 17455, 17406, 17358, 17309, 17261, 17212, 17164, 17115, - 17067, 17018, 16970, 16921, 16872, 16824, 16775, 16727, - 16678, 16629, 16581, 16532, 16484, 16435, 16386, 16338, - 16289, 16240, 16191, 16143, 16094, 16045, 15997, 15948, - 15899, 15850, 15802, 15753, 15704, 15655, 15606, 15557, - 15509, 15460, 15411, 15362, 15313, 15264, 15215, 15167, - 15118, 15069, 15020, 14971, 14922, 14873, 14824, 14775, - 14726, 14677, 14628, 14579, 14530, 14481, 14432, 14383, - 14334, 14285, 14236, 14187, 14138, 14089, 14040, 13990, - 13941, 13892, 13843, 13794, 13745, 13696, 13646, 13597, - 13548, 13499, 13450, 13401, 13351, 13302, 13253, 13204, - 13154, 13105, 13056, 13007, 12957, 12908, 12859, 12810, - 12760, 12711, 12662, 12612, 12563, 12514, 12464, 12415, - 12366, 12316, 12267, 12218, 12168, 12119, 12069, 12020, - 11970, 11921, 11872, 11822, 11773, 11723, 11674, 11624, - 11575, 11525, 11476, 11426, 11377, 11327, 11278, 11228, - 11179, 11129, 11080, 11030, 10981, 10931, 10882, 10832, - 10782, 10733, 10683, 10634, 10584, 10534, 10485, 10435, - 10386, 10336, 10286, 10237, 10187, 10137, 10088, 10038, - 9988, 9939, 9889, 9839, 9790, 9740, 9690, 9640, - 9591, 9541, 9491, 9442, 9392, 9342, 9292, 9243, - 9193, 9143, 9093, 9043, 8994, 8944, 8894, 8844, - 8794, 8745, 8695, 8645, 8595, 8545, 8496, 8446, - 8396, 8346, 8296, 8246, 8196, 8147, 8097, 8047, - 7997, 7947, 7897, 7847, 7797, 7747, 7697, 7648, - 7598, 7548, 7498, 7448, 7398, 7348, 7298, 7248, - 7198, 7148, 7098, 7048, 6998, 6948, 6898, 6848, - 6798, 6748, 6698, 6648, 6598, 6548, 6498, 6448, - 6398, 6348, 6298, 6248, 6198, 6148, 6098, 6048, - 5998, 5948, 5898, 5848, 5798, 5748, 5697, 5647, - 5597, 5547, 5497, 5447, 5397, 5347, 5297, 5247, - 5197, 5146, 5096, 5046, 4996, 4946, 4896, 4846, - 4796, 4745, 4695, 4645, 4595, 4545, 4495, 4445, - 4394, 4344, 4294, 4244, 4194, 4144, 4093, 4043, - 3993, 3943, 3893, 3843, 3792, 3742, 3692, 3642, - 3592, 3541, 3491, 3441, 3391, 3341, 3291, 3240, - 3190, 3140, 3090, 3039, 2989, 2939, 2889, 2839, - 2788, 2738, 2688, 2638, 2587, 2537, 2487, 2437, - 2387, 2336, 2286, 2236, 2186, 2135, 2085, 2035, - 1985, 1934, 1884, 1834, 1784, 1733, 1683, 1633, - 1583, 1532, 1482, 1432, 1382, 1331, 1281, 1231, - 1181, 1130, 1080, 1030, 980, 929, 879, 829, - 779, 728, 678, 628, 578, 527, 477, 427, - 376, 326, 276, 226, 175, 125, 75, 25, - -25, -75, -125, -175, -226, -276, -326, -376, - -427, -477, -527, -578, -628, -678, -728, -779, - -829, -879, -929, -980, -1030, -1080, -1130, -1181, - -1231, -1281, -1331, -1382, -1432, -1482, -1532, -1583, - -1633, -1683, -1733, -1784, -1834, -1884, -1934, -1985, - -2035, -2085, -2135, -2186, -2236, -2286, -2336, -2387, - -2437, -2487, -2537, -2588, -2638, -2688, -2738, -2788, - -2839, -2889, -2939, -2989, -3039, -3090, -3140, -3190, - -3240, -3291, -3341, -3391, -3441, -3491, -3541, -3592, - -3642, -3692, -3742, -3792, -3843, -3893, -3943, -3993, - -4043, -4093, -4144, -4194, -4244, -4294, -4344, -4394, - -4445, -4495, -4545, -4595, -4645, -4695, -4745, -4796, - -4846, -4896, -4946, -4996, -5046, -5096, -5146, -5197, - -5247, -5297, -5347, -5397, -5447, -5497, -5547, -5597, - -5647, -5697, -5748, -5798, -5848, -5898, -5948, -5998, - -6048, -6098, -6148, -6198, -6248, -6298, -6348, -6398, - -6448, -6498, -6548, -6598, -6648, -6698, -6748, -6798, - -6848, -6898, -6948, -6998, -7048, -7098, -7148, -7198, - -7248, -7298, -7348, -7398, -7448, -7498, -7548, -7598, - -7648, -7697, -7747, -7797, -7847, -7897, -7947, -7997, - -8047, -8097, -8147, -8196, -8246, -8296, -8346, -8396, - -8446, -8496, -8545, -8595, -8645, -8695, -8745, -8794, - -8844, -8894, -8944, -8994, -9043, -9093, -9143, -9193, - -9243, -9292, -9342, -9392, -9442, -9491, -9541, -9591, - -9640, -9690, -9740, -9790, -9839, -9889, -9939, -9988, - -10038, -10088, -10137, -10187, -10237, -10286, -10336, -10386, - -10435, -10485, -10534, -10584, -10634, -10683, -10733, -10782, - -10832, -10882, -10931, -10981, -11030, -11080, -11129, -11179, - -11228, -11278, -11327, -11377, -11426, -11476, -11525, -11575, - -11624, -11674, -11723, -11773, -11822, -11872, -11921, -11970, - -12020, -12069, -12119, -12168, -12218, -12267, -12316, -12366, - -12415, -12464, -12514, -12563, -12612, -12662, -12711, -12760, - -12810, -12859, -12908, -12957, -13007, -13056, -13105, -13154, - -13204, -13253, -13302, -13351, -13401, -13450, -13499, -13548, - -13597, -13647, -13696, -13745, -13794, -13843, -13892, -13941, - -13990, -14040, -14089, -14138, -14187, -14236, -14285, -14334, - -14383, -14432, -14481, -14530, -14579, -14628, -14677, -14726, - -14775, -14824, -14873, -14922, -14971, -15020, -15069, -15118, - -15167, -15215, -15264, -15313, -15362, -15411, -15460, -15509, - -15557, -15606, -15655, -15704, -15753, -15802, -15850, -15899, - -15948, -15997, -16045, -16094, -16143, -16191, -16240, -16289, - -16338, -16386, -16435, -16484, -16532, -16581, -16629, -16678, - -16727, -16775, -16824, -16872, -16921, -16970, -17018, -17067, - -17115, -17164, -17212, -17261, -17309, -17358, -17406, -17455, - -17503, -17551, -17600, -17648, -17697, -17745, -17793, -17842, - -17890, -17939, -17987, -18035, -18084, -18132, -18180, -18228, - -18277, -18325, -18373, -18421, -18470, -18518, -18566, -18614, - -18663, -18711, -18759, -18807, -18855, -18903, -18951, -19000, - -19048, -19096, -19144, -19192, -19240, -19288, -19336, -19384, - -19432, -19480, -19528, -19576, -19624, -19672, -19720, -19768, - -19816, -19864, -19912, -19959, -20007, -20055, -20103, -20151, - -20199, -20246, -20294, -20342, -20390, -20438, -20485, -20533, - -20581, -20629, -20676, -20724, -20772, -20819, -20867, -20915, - -20962, -21010, -21057, -21105, -21153, -21200, -21248, -21295, - -21343, -21390, -21438, -21485, -21533, -21580, -21628, -21675, - -21723, -21770, -21817, -21865, -21912, -21960, -22007, -22054, - -22102, -22149, -22196, -22243, -22291, -22338, -22385, -22433, - -22480, -22527, -22574, -22621, -22668, -22716, -22763, -22810, - -22857, -22904, -22951, -22998, -23045, -23092, -23139, -23186, - -23233, -23280, -23327, -23374, -23421, -23468, -23515, -23562, - -23609, -23656, -23703, -23750, -23796, -23843, -23890, -23937, - -23984, -24030, -24077, -24124, -24171, -24217, -24264, -24311, - -24357, -24404, -24451, -24497, -24544, -24591, -24637, -24684, - -24730, -24777, -24823, -24870, -24916, -24963, -25009, -25056, - -25102, -25149, -25195, -25241, -25288, -25334, -25381, -25427, - -25473, -25520, -25566, -25612, -25658, -25705, -25751, -25797, - -25843, -25889, -25936, -25982, -26028, -26074, -26120, -26166, - -26212, -26258, -26304, -26350, -26396, -26442, -26488, -26534, - -26580, -26626, -26672, -26718, -26764, -26810, -26856, -26902, - -26947, -26993, -27039, -27085, -27131, -27176, -27222, -27268, - -27313, -27359, -27405, -27450, -27496, -27542, -27587, -27633, - -27678, -27724, -27770, -27815, -27861, -27906, -27952, -27997, - -28042, -28088, -28133, -28179, -28224, -28269, -28315, -28360, - -28405, -28451, -28496, -28541, -28586, -28632, -28677, -28722, - -28767, -28812, -28858, -28903, -28948, -28993, -29038, -29083, - -29128, -29173, -29218, -29263, -29308, -29353, -29398, -29443, - -29488, -29533, -29577, -29622, -29667, -29712, -29757, -29801, - -29846, -29891, -29936, -29980, -30025, -30070, -30114, -30159, - -30204, -30248, -30293, -30337, -30382, -30426, -30471, -30515, - -30560, -30604, -30649, -30693, -30738, -30782, -30826, -30871, - -30915, -30959, -31004, -31048, -31092, -31136, -31181, -31225, - -31269, -31313, -31357, -31402, -31446, -31490, -31534, -31578, - -31622, -31666, -31710, -31754, -31798, -31842, -31886, -31930, - -31974, -32017, -32061, -32105, -32149, -32193, -32236, -32280, - -32324, -32368, -32411, -32455, -32499, -32542, -32586, -32630, - -32673, -32717, -32760, -32804, -32847, -32891, -32934, -32978, - -33021, -33065, -33108, -33151, -33195, -33238, -33281, -33325, - -33368, -33411, -33454, -33498, -33541, -33584, -33627, -33670, - -33713, -33756, -33799, -33843, -33886, -33929, -33972, -34015, - -34057, -34100, -34143, -34186, -34229, -34272, -34315, -34358, - -34400, -34443, -34486, -34529, -34571, -34614, -34657, -34699, - -34742, -34785, -34827, -34870, -34912, -34955, -34997, -35040, - -35082, -35125, -35167, -35210, -35252, -35294, -35337, -35379, - -35421, -35464, -35506, -35548, -35590, -35633, -35675, -35717, - -35759, -35801, -35843, -35885, -35927, -35969, -36011, -36053, - -36095, -36137, -36179, -36221, -36263, -36305, -36347, -36388, - -36430, -36472, -36514, -36555, -36597, -36639, -36681, -36722, - -36764, -36805, -36847, -36889, -36930, -36972, -37013, -37055, - -37096, -37137, -37179, -37220, -37262, -37303, -37344, -37386, - -37427, -37468, -37509, -37551, -37592, -37633, -37674, -37715, - -37756, -37797, -37838, -37879, -37920, -37961, -38002, -38043, - -38084, -38125, -38166, -38207, -38248, -38288, -38329, -38370, - -38411, -38451, -38492, -38533, -38573, -38614, -38655, -38695, - -38736, -38776, -38817, -38857, -38898, -38938, -38979, -39019, - -39059, -39100, -39140, -39180, -39221, -39261, -39301, -39341, - -39382, -39422, -39462, -39502, -39542, -39582, -39622, -39662, - -39702, -39742, -39782, -39822, -39862, -39902, -39942, -39982, - -40021, -40061, -40101, -40141, -40180, -40220, -40260, -40299, - -40339, -40379, -40418, -40458, -40497, -40537, -40576, -40616, - -40655, -40695, -40734, -40773, -40813, -40852, -40891, -40931, - -40970, -41009, -41048, -41087, -41127, -41166, -41205, -41244, - -41283, -41322, -41361, -41400, -41439, -41478, -41517, -41556, - -41595, -41633, -41672, -41711, -41750, -41788, -41827, -41866, - -41904, -41943, -41982, -42020, -42059, -42097, -42136, -42174, - -42213, -42251, -42290, -42328, -42366, -42405, -42443, -42481, - -42520, -42558, -42596, -42634, -42672, -42711, -42749, -42787, - -42825, -42863, -42901, -42939, -42977, -43015, -43053, -43091, - -43128, -43166, -43204, -43242, -43280, -43317, -43355, -43393, - -43430, -43468, -43506, -43543, -43581, -43618, -43656, -43693, - -43731, -43768, -43806, -43843, -43880, -43918, -43955, -43992, - -44029, -44067, -44104, -44141, -44178, -44215, -44252, -44289, - -44326, -44363, -44400, -44437, -44474, -44511, -44548, -44585, - -44622, -44659, -44695, -44732, -44769, -44806, -44842, -44879, - -44915, -44952, -44989, -45025, -45062, -45098, -45135, -45171, - -45207, -45244, -45280, -45316, -45353, -45389, -45425, -45462, - -45498, -45534, -45570, -45606, -45642, -45678, -45714, -45750, - -45786, -45822, -45858, -45894, -45930, -45966, -46002, -46037, - -46073, -46109, -46145, -46180, -46216, -46252, -46287, -46323, - -46358, -46394, -46429, -46465, -46500, -46536, -46571, -46606, - -46642, -46677, -46712, -46747, -46783, -46818, -46853, -46888, - -46923, -46958, -46993, -47028, -47063, -47098, -47133, -47168, - -47203, -47238, -47273, -47308, -47342, -47377, -47412, -47446, - -47481, -47516, -47550, -47585, -47619, -47654, -47688, -47723, - -47757, -47792, -47826, -47860, -47895, -47929, -47963, -47998, - -48032, -48066, -48100, -48134, -48168, -48202, -48236, -48271, - -48304, -48338, -48372, -48406, -48440, -48474, -48508, -48542, - -48575, -48609, -48643, -48676, -48710, -48744, -48777, -48811, - -48844, -48878, -48911, -48945, -48978, -49012, -49045, -49078, - -49112, -49145, -49178, -49211, -49244, -49278, -49311, -49344, - -49377, -49410, -49443, -49476, -49509, -49542, -49575, -49608, - -49640, -49673, -49706, -49739, -49771, -49804, -49837, -49869, - -49902, -49935, -49967, -50000, -50032, -50065, -50097, -50129, - -50162, -50194, -50226, -50259, -50291, -50323, -50355, -50387, - -50420, -50452, -50484, -50516, -50548, -50580, -50612, -50644, - -50675, -50707, -50739, -50771, -50803, -50834, -50866, -50898, - -50929, -50961, -50993, -51024, -51056, -51087, -51119, -51150, - -51182, -51213, -51244, -51276, -51307, -51338, -51369, -51401, - -51432, -51463, -51494, -51525, -51556, -51587, -51618, -51649, - -51680, -51711, -51742, -51773, -51803, -51834, -51865, -51896, - -51926, -51957, -51988, -52018, -52049, -52079, -52110, -52140, - -52171, -52201, -52231, -52262, -52292, -52322, -52353, -52383, - -52413, -52443, -52473, -52503, -52534, -52564, -52594, -52624, - -52653, -52683, -52713, -52743, -52773, -52803, -52832, -52862, - -52892, -52922, -52951, -52981, -53010, -53040, -53069, -53099, - -53128, -53158, -53187, -53216, -53246, -53275, -53304, -53334, - -53363, -53392, -53421, -53450, -53479, -53508, -53537, -53566, - -53595, -53624, -53653, -53682, -53711, -53739, -53768, -53797, - -53826, -53854, -53883, -53911, -53940, -53969, -53997, -54026, - -54054, -54082, -54111, -54139, -54167, -54196, -54224, -54252, - -54280, -54308, -54337, -54365, -54393, -54421, -54449, -54477, - -54505, -54533, -54560, -54588, -54616, -54644, -54672, -54699, - -54727, -54755, -54782, -54810, -54837, -54865, -54892, -54920, - -54947, -54974, -55002, -55029, -55056, -55084, -55111, -55138, - -55165, -55192, -55219, -55246, -55274, -55300, -55327, -55354, - -55381, -55408, -55435, -55462, -55489, -55515, -55542, -55569, - -55595, -55622, -55648, -55675, -55701, -55728, -55754, -55781, - -55807, -55833, -55860, -55886, -55912, -55938, -55965, -55991, - -56017, -56043, -56069, -56095, -56121, -56147, -56173, -56199, - -56225, -56250, -56276, -56302, -56328, -56353, -56379, -56404, - -56430, -56456, -56481, -56507, -56532, -56557, -56583, -56608, - -56633, -56659, -56684, -56709, -56734, -56760, -56785, -56810, - -56835, -56860, -56885, -56910, -56935, -56959, -56984, -57009, - -57034, -57059, -57083, -57108, -57133, -57157, -57182, -57206, - -57231, -57255, -57280, -57304, -57329, -57353, -57377, -57402, - -57426, -57450, -57474, -57498, -57522, -57546, -57570, -57594, - -57618, -57642, -57666, -57690, -57714, -57738, -57762, -57785, - -57809, -57833, -57856, -57880, -57903, -57927, -57950, -57974, - -57997, -58021, -58044, -58067, -58091, -58114, -58137, -58160, - -58183, -58207, -58230, -58253, -58276, -58299, -58322, -58345, - -58367, -58390, -58413, -58436, -58459, -58481, -58504, -58527, - -58549, -58572, -58594, -58617, -58639, -58662, -58684, -58706, - -58729, -58751, -58773, -58795, -58818, -58840, -58862, -58884, - -58906, -58928, -58950, -58972, -58994, -59016, -59038, -59059, - -59081, -59103, -59125, -59146, -59168, -59190, -59211, -59233, - -59254, -59276, -59297, -59318, -59340, -59361, -59382, -59404, - -59425, -59446, -59467, -59488, -59509, -59530, -59551, -59572, - -59593, -59614, -59635, -59656, -59677, -59697, -59718, -59739, - -59759, -59780, -59801, -59821, -59842, -59862, -59883, -59903, - -59923, -59944, -59964, -59984, -60004, -60025, -60045, -60065, - -60085, -60105, -60125, -60145, -60165, -60185, -60205, -60225, - -60244, -60264, -60284, -60304, -60323, -60343, -60363, -60382, - -60402, -60421, -60441, -60460, -60479, -60499, -60518, -60537, - -60556, -60576, -60595, -60614, -60633, -60652, -60671, -60690, - -60709, -60728, -60747, -60766, -60785, -60803, -60822, -60841, - -60859, -60878, -60897, -60915, -60934, -60952, -60971, -60989, - -61007, -61026, -61044, -61062, -61081, -61099, -61117, -61135, - -61153, -61171, -61189, -61207, -61225, -61243, -61261, -61279, - -61297, -61314, -61332, -61350, -61367, -61385, -61403, -61420, - -61438, -61455, -61473, -61490, -61507, -61525, -61542, -61559, - -61577, -61594, -61611, -61628, -61645, -61662, -61679, -61696, - -61713, -61730, -61747, -61764, -61780, -61797, -61814, -61831, - -61847, -61864, -61880, -61897, -61913, -61930, -61946, -61963, - -61979, -61995, -62012, -62028, -62044, -62060, -62076, -62092, - -62108, -62125, -62141, -62156, -62172, -62188, -62204, -62220, - -62236, -62251, -62267, -62283, -62298, -62314, -62329, -62345, - -62360, -62376, -62391, -62407, -62422, -62437, -62453, -62468, - -62483, -62498, -62513, -62528, -62543, -62558, -62573, -62588, - -62603, -62618, -62633, -62648, -62662, -62677, -62692, -62706, - -62721, -62735, -62750, -62764, -62779, -62793, -62808, -62822, - -62836, -62850, -62865, -62879, -62893, -62907, -62921, -62935, - -62949, -62963, -62977, -62991, -63005, -63019, -63032, -63046, - -63060, -63074, -63087, -63101, -63114, -63128, -63141, -63155, - -63168, -63182, -63195, -63208, -63221, -63235, -63248, -63261, - -63274, -63287, -63300, -63313, -63326, -63339, -63352, -63365, - -63378, -63390, -63403, -63416, -63429, -63441, -63454, -63466, - -63479, -63491, -63504, -63516, -63528, -63541, -63553, -63565, - -63578, -63590, -63602, -63614, -63626, -63638, -63650, -63662, - -63674, -63686, -63698, -63709, -63721, -63733, -63745, -63756, - -63768, -63779, -63791, -63803, -63814, -63825, -63837, -63848, - -63859, -63871, -63882, -63893, -63904, -63915, -63927, -63938, - -63949, -63960, -63971, -63981, -63992, -64003, -64014, -64025, - -64035, -64046, -64057, -64067, -64078, -64088, -64099, -64109, - -64120, -64130, -64140, -64151, -64161, -64171, -64181, -64192, - -64202, -64212, -64222, -64232, -64242, -64252, -64261, -64271, - -64281, -64291, -64301, -64310, -64320, -64330, -64339, -64349, - -64358, -64368, -64377, -64387, -64396, -64405, -64414, -64424, - -64433, -64442, -64451, -64460, -64469, -64478, -64487, -64496, - -64505, -64514, -64523, -64532, -64540, -64549, -64558, -64566, - -64575, -64584, -64592, -64601, -64609, -64617, -64626, -64634, - -64642, -64651, -64659, -64667, -64675, -64683, -64691, -64699, - -64707, -64715, -64723, -64731, -64739, -64747, -64754, -64762, - -64770, -64777, -64785, -64793, -64800, -64808, -64815, -64822, - -64830, -64837, -64844, -64852, -64859, -64866, -64873, -64880, - -64887, -64895, -64902, -64908, -64915, -64922, -64929, -64936, - -64943, -64949, -64956, -64963, -64969, -64976, -64982, -64989, - -64995, -65002, -65008, -65015, -65021, -65027, -65033, -65040, - -65046, -65052, -65058, -65064, -65070, -65076, -65082, -65088, - -65094, -65099, -65105, -65111, -65117, -65122, -65128, -65133, - -65139, -65144, -65150, -65155, -65161, -65166, -65171, -65177, - -65182, -65187, -65192, -65197, -65202, -65207, -65212, -65217, - -65222, -65227, -65232, -65237, -65242, -65246, -65251, -65256, - -65260, -65265, -65270, -65274, -65279, -65283, -65287, -65292, - -65296, -65300, -65305, -65309, -65313, -65317, -65321, -65325, - -65329, -65333, -65337, -65341, -65345, -65349, -65352, -65356, - -65360, -65363, -65367, -65371, -65374, -65378, -65381, -65385, - -65388, -65391, -65395, -65398, -65401, -65404, -65408, -65411, - -65414, -65417, -65420, -65423, -65426, -65429, -65431, -65434, - -65437, -65440, -65442, -65445, -65448, -65450, -65453, -65455, - -65458, -65460, -65463, -65465, -65467, -65470, -65472, -65474, - -65476, -65478, -65480, -65482, -65484, -65486, -65488, -65490, - -65492, -65494, -65496, -65497, -65499, -65501, -65502, -65504, - -65505, -65507, -65508, -65510, -65511, -65513, -65514, -65515, - -65516, -65518, -65519, -65520, -65521, -65522, -65523, -65524, - -65525, -65526, -65527, -65527, -65528, -65529, -65530, -65530, + 65536, 65535, 65535, 65535, 65535, 65535, 65535, 65535, + 65534, 65534, 65534, 65533, 65533, 65532, 65532, 65531, + 65531, 65530, 65529, 65529, 65528, 65527, 65526, 65525, + 65524, 65523, 65522, 65521, 65520, 65519, 65518, 65517, + 65516, 65515, 65513, 65512, 65511, 65509, 65508, 65506, + 65505, 65503, 65501, 65500, 65498, 65496, 65495, 65493, + 65491, 65489, 65487, 65485, 65483, 65481, 65479, 65477, + 65475, 65473, 65471, 65468, 65466, 65464, 65461, 65459, + 65457, 65454, 65452, 65449, 65446, 65444, 65441, 65438, + 65436, 65433, 65430, 65427, 65424, 65421, 65418, 65415, + 65412, 65409, 65406, 65403, 65400, 65396, 65393, 65390, + 65386, 65383, 65379, 65376, 65372, 65369, 65365, 65362, + 65358, 65354, 65350, 65347, 65343, 65339, 65335, 65331, + 65327, 65323, 65319, 65315, 65311, 65307, 65302, 65298, + 65294, 65290, 65285, 65281, 65276, 65272, 65267, 65263, + 65258, 65253, 65249, 65244, 65239, 65235, 65230, 65225, + 65220, 65215, 65210, 65205, 65200, 65195, 65190, 65184, + 65179, 65174, 65169, 65163, 65158, 65153, 65147, 65142, + 65136, 65131, 65125, 65119, 65114, 65108, 65102, 65096, + 65091, 65085, 65079, 65073, 65067, 65061, 65055, 65049, + 65043, 65036, 65030, 65024, 65018, 65011, 65005, 64999, + 64992, 64986, 64979, 64973, 64966, 64959, 64953, 64946, + 64939, 64933, 64926, 64919, 64912, 64905, 64898, 64891, + 64884, 64877, 64870, 64863, 64855, 64848, 64841, 64834, + 64826, 64819, 64811, 64804, 64796, 64789, 64781, 64774, + 64766, 64758, 64751, 64743, 64735, 64727, 64719, 64711, + 64703, 64695, 64687, 64679, 64671, 64663, 64655, 64646, + 64638, 64630, 64622, 64613, 64605, 64596, 64588, 64579, + 64571, 64562, 64553, 64545, 64536, 64527, 64518, 64510, + 64501, 64492, 64483, 64474, 64465, 64456, 64447, 64437, + 64428, 64419, 64410, 64401, 64391, 64382, 64372, 64363, + 64353, 64344, 64334, 64325, 64315, 64305, 64296, 64286, + 64276, 64266, 64257, 64247, 64237, 64227, 64217, 64207, + 64197, 64186, 64176, 64166, 64156, 64146, 64135, 64125, + 64115, 64104, 64094, 64083, 64073, 64062, 64051, 64041, + 64030, 64019, 64009, 63998, 63987, 63976, 63965, 63954, + 63943, 63932, 63921, 63910, 63899, 63888, 63876, 63865, + 63854, 63842, 63831, 63820, 63808, 63797, 63785, 63774, + 63762, 63750, 63739, 63727, 63715, 63704, 63692, 63680, + 63668, 63656, 63644, 63632, 63620, 63608, 63596, 63584, + 63571, 63559, 63547, 63535, 63522, 63510, 63498, 63485, + 63473, 63460, 63447, 63435, 63422, 63410, 63397, 63384, + 63371, 63358, 63346, 63333, 63320, 63307, 63294, 63281, + 63268, 63254, 63241, 63228, 63215, 63202, 63188, 63175, + 63162, 63148, 63135, 63121, 63108, 63094, 63080, 63067, + 63053, 63039, 63026, 63012, 62998, 62984, 62970, 62956, + 62942, 62928, 62914, 62900, 62886, 62872, 62858, 62843, + 62829, 62815, 62800, 62786, 62772, 62757, 62743, 62728, + 62714, 62699, 62684, 62670, 62655, 62640, 62625, 62610, + 62596, 62581, 62566, 62551, 62536, 62521, 62506, 62491, + 62475, 62460, 62445, 62430, 62414, 62399, 62384, 62368, + 62353, 62337, 62322, 62306, 62291, 62275, 62259, 62244, + 62228, 62212, 62196, 62180, 62164, 62148, 62133, 62117, + 62100, 62084, 62068, 62052, 62036, 62020, 62003, 61987, + 61971, 61954, 61938, 61922, 61905, 61889, 61872, 61855, + 61839, 61822, 61805, 61789, 61772, 61755, 61738, 61721, + 61705, 61688, 61671, 61654, 61637, 61619, 61602, 61585, + 61568, 61551, 61533, 61516, 61499, 61481, 61464, 61446, + 61429, 61411, 61394, 61376, 61359, 61341, 61323, 61305, + 61288, 61270, 61252, 61234, 61216, 61198, 61180, 61162, + 61144, 61126, 61108, 61090, 61071, 61053, 61035, 61017, + 60998, 60980, 60961, 60943, 60924, 60906, 60887, 60869, + 60850, 60831, 60813, 60794, 60775, 60756, 60737, 60719, + 60700, 60681, 60662, 60643, 60624, 60604, 60585, 60566, + 60547, 60528, 60508, 60489, 60470, 60450, 60431, 60411, + 60392, 60372, 60353, 60333, 60313, 60294, 60274, 60254, + 60235, 60215, 60195, 60175, 60155, 60135, 60115, 60095, + 60075, 60055, 60035, 60015, 59994, 59974, 59954, 59934, + 59913, 59893, 59872, 59852, 59831, 59811, 59790, 59770, + 59749, 59728, 59708, 59687, 59666, 59645, 59625, 59604, + 59583, 59562, 59541, 59520, 59499, 59478, 59457, 59435, + 59414, 59393, 59372, 59350, 59329, 59308, 59286, 59265, + 59243, 59222, 59200, 59179, 59157, 59135, 59114, 59092, + 59070, 59049, 59027, 59005, 58983, 58961, 58939, 58917, + 58895, 58873, 58851, 58829, 58807, 58784, 58762, 58740, + 58718, 58695, 58673, 58650, 58628, 58605, 58583, 58560, + 58538, 58515, 58493, 58470, 58447, 58424, 58402, 58379, + 58356, 58333, 58310, 58287, 58264, 58241, 58218, 58195, + 58172, 58149, 58125, 58102, 58079, 58056, 58032, 58009, + 57986, 57962, 57939, 57915, 57892, 57868, 57844, 57821, + 57797, 57773, 57750, 57726, 57702, 57678, 57654, 57630, + 57606, 57582, 57558, 57534, 57510, 57486, 57462, 57438, + 57414, 57389, 57365, 57341, 57316, 57292, 57268, 57243, + 57219, 57194, 57170, 57145, 57120, 57096, 57071, 57046, + 57022, 56997, 56972, 56947, 56922, 56897, 56872, 56847, + 56822, 56797, 56772, 56747, 56722, 56697, 56671, 56646, + 56621, 56595, 56570, 56545, 56519, 56494, 56468, 56443, + 56417, 56392, 56366, 56340, 56315, 56289, 56263, 56237, + 56212, 56186, 56160, 56134, 56108, 56082, 56056, 56030, + 56004, 55978, 55952, 55925, 55899, 55873, 55847, 55820, + 55794, 55768, 55741, 55715, 55688, 55662, 55635, 55609, + 55582, 55555, 55529, 55502, 55475, 55448, 55422, 55395, + 55368, 55341, 55314, 55287, 55260, 55233, 55206, 55179, + 55152, 55124, 55097, 55070, 55043, 55015, 54988, 54961, + 54933, 54906, 54879, 54851, 54823, 54796, 54768, 54741, + 54713, 54685, 54658, 54630, 54602, 54574, 54546, 54519, + 54491, 54463, 54435, 54407, 54379, 54351, 54323, 54294, + 54266, 54238, 54210, 54182, 54153, 54125, 54097, 54068, + 54040, 54011, 53983, 53954, 53926, 53897, 53869, 53840, + 53811, 53783, 53754, 53725, 53696, 53667, 53639, 53610, + 53581, 53552, 53523, 53494, 53465, 53436, 53407, 53377, + 53348, 53319, 53290, 53260, 53231, 53202, 53172, 53143, + 53114, 53084, 53055, 53025, 52996, 52966, 52936, 52907, + 52877, 52847, 52818, 52788, 52758, 52728, 52698, 52668, + 52639, 52609, 52579, 52549, 52518, 52488, 52458, 52428, + 52398, 52368, 52338, 52307, 52277, 52247, 52216, 52186, + 52155, 52125, 52095, 52064, 52033, 52003, 51972, 51942, + 51911, 51880, 51850, 51819, 51788, 51757, 51726, 51695, + 51665, 51634, 51603, 51572, 51541, 51510, 51478, 51447, + 51416, 51385, 51354, 51323, 51291, 51260, 51229, 51197, + 51166, 51134, 51103, 51072, 51040, 51008, 50977, 50945, + 50914, 50882, 50850, 50819, 50787, 50755, 50723, 50691, + 50660, 50628, 50596, 50564, 50532, 50500, 50468, 50436, + 50403, 50371, 50339, 50307, 50275, 50242, 50210, 50178, + 50146, 50113, 50081, 50048, 50016, 49983, 49951, 49918, + 49886, 49853, 49820, 49788, 49755, 49722, 49690, 49657, + 49624, 49591, 49558, 49525, 49492, 49459, 49426, 49393, + 49360, 49327, 49294, 49261, 49228, 49195, 49161, 49128, + 49095, 49062, 49028, 48995, 48961, 48928, 48895, 48861, + 48828, 48794, 48760, 48727, 48693, 48660, 48626, 48592, + 48558, 48525, 48491, 48457, 48423, 48389, 48355, 48321, + 48288, 48254, 48219, 48185, 48151, 48117, 48083, 48049, + 48015, 47981, 47946, 47912, 47878, 47843, 47809, 47775, + 47740, 47706, 47671, 47637, 47602, 47568, 47533, 47498, + 47464, 47429, 47394, 47360, 47325, 47290, 47255, 47220, + 47186, 47151, 47116, 47081, 47046, 47011, 46976, 46941, + 46906, 46871, 46835, 46800, 46765, 46730, 46695, 46659, + 46624, 46589, 46553, 46518, 46482, 46447, 46411, 46376, + 46340, 46305, 46269, 46234, 46198, 46162, 46127, 46091, + 46055, 46019, 45984, 45948, 45912, 45876, 45840, 45804, + 45768, 45732, 45696, 45660, 45624, 45588, 45552, 45516, + 45480, 45443, 45407, 45371, 45335, 45298, 45262, 45226, + 45189, 45153, 45116, 45080, 45043, 45007, 44970, 44934, + 44897, 44861, 44824, 44787, 44750, 44714, 44677, 44640, + 44603, 44567, 44530, 44493, 44456, 44419, 44382, 44345, + 44308, 44271, 44234, 44197, 44160, 44122, 44085, 44048, + 44011, 43974, 43936, 43899, 43862, 43824, 43787, 43749, + 43712, 43675, 43637, 43600, 43562, 43524, 43487, 43449, + 43412, 43374, 43336, 43298, 43261, 43223, 43185, 43147, + 43110, 43072, 43034, 42996, 42958, 42920, 42882, 42844, + 42806, 42768, 42730, 42692, 42653, 42615, 42577, 42539, + 42501, 42462, 42424, 42386, 42347, 42309, 42271, 42232, + 42194, 42155, 42117, 42078, 42040, 42001, 41962, 41924, + 41885, 41846, 41808, 41769, 41730, 41692, 41653, 41614, + 41575, 41536, 41497, 41458, 41419, 41381, 41342, 41303, + 41263, 41224, 41185, 41146, 41107, 41068, 41029, 40990, + 40950, 40911, 40872, 40832, 40793, 40754, 40714, 40675, + 40636, 40596, 40557, 40517, 40478, 40438, 40399, 40359, + 40319, 40280, 40240, 40200, 40161, 40121, 40081, 40041, + 40002, 39962, 39922, 39882, 39842, 39802, 39762, 39722, + 39682, 39642, 39602, 39562, 39522, 39482, 39442, 39402, + 39362, 39321, 39281, 39241, 39201, 39160, 39120, 39080, + 39039, 38999, 38958, 38918, 38878, 38837, 38797, 38756, + 38716, 38675, 38634, 38594, 38553, 38512, 38472, 38431, + 38390, 38350, 38309, 38268, 38227, 38186, 38146, 38105, + 38064, 38023, 37982, 37941, 37900, 37859, 37818, 37777, + 37736, 37695, 37653, 37612, 37571, 37530, 37489, 37447, + 37406, 37365, 37324, 37282, 37241, 37200, 37158, 37117, + 37075, 37034, 36992, 36951, 36909, 36868, 36826, 36785, + 36743, 36701, 36660, 36618, 36576, 36535, 36493, 36451, + 36409, 36368, 36326, 36284, 36242, 36200, 36158, 36116, + 36074, 36032, 35990, 35948, 35906, 35864, 35822, 35780, + 35738, 35696, 35654, 35611, 35569, 35527, 35485, 35442, + 35400, 35358, 35316, 35273, 35231, 35188, 35146, 35104, + 35061, 35019, 34976, 34934, 34891, 34849, 34806, 34763, + 34721, 34678, 34635, 34593, 34550, 34507, 34465, 34422, + 34379, 34336, 34293, 34251, 34208, 34165, 34122, 34079, + 34036, 33993, 33950, 33907, 33864, 33821, 33778, 33735, + 33692, 33649, 33605, 33562, 33519, 33476, 33433, 33389, + 33346, 33303, 33260, 33216, 33173, 33130, 33086, 33043, + 32999, 32956, 32912, 32869, 32826, 32782, 32738, 32695, + 32651, 32608, 32564, 32521, 32477, 32433, 32390, 32346, + 32302, 32258, 32215, 32171, 32127, 32083, 32039, 31995, + 31952, 31908, 31864, 31820, 31776, 31732, 31688, 31644, + 31600, 31556, 31512, 31468, 31424, 31379, 31335, 31291, + 31247, 31203, 31159, 31114, 31070, 31026, 30982, 30937, + 30893, 30849, 30804, 30760, 30715, 30671, 30627, 30582, + 30538, 30493, 30449, 30404, 30360, 30315, 30271, 30226, + 30181, 30137, 30092, 30047, 30003, 29958, 29913, 29869, + 29824, 29779, 29734, 29690, 29645, 29600, 29555, 29510, + 29465, 29420, 29375, 29330, 29285, 29241, 29196, 29151, + 29105, 29060, 29015, 28970, 28925, 28880, 28835, 28790, + 28745, 28699, 28654, 28609, 28564, 28519, 28473, 28428, + 28383, 28337, 28292, 28247, 28201, 28156, 28111, 28065, + 28020, 27974, 27929, 27883, 27838, 27792, 27747, 27701, + 27656, 27610, 27565, 27519, 27473, 27428, 27382, 27336, + 27291, 27245, 27199, 27153, 27108, 27062, 27016, 26970, + 26925, 26879, 26833, 26787, 26741, 26695, 26649, 26603, + 26557, 26511, 26465, 26419, 26373, 26327, 26281, 26235, + 26189, 26143, 26097, 26051, 26005, 25959, 25913, 25866, + 25820, 25774, 25728, 25681, 25635, 25589, 25543, 25496, + 25450, 25404, 25357, 25311, 25265, 25218, 25172, 25125, + 25079, 25033, 24986, 24940, 24893, 24847, 24800, 24754, + 24707, 24660, 24614, 24567, 24521, 24474, 24427, 24381, + 24334, 24287, 24241, 24194, 24147, 24101, 24054, 24007, + 23960, 23914, 23867, 23820, 23773, 23726, 23679, 23632, + 23586, 23539, 23492, 23445, 23398, 23351, 23304, 23257, + 23210, 23163, 23116, 23069, 23022, 22975, 22928, 22881, + 22833, 22786, 22739, 22692, 22645, 22598, 22551, 22503, + 22456, 22409, 22362, 22314, 22267, 22220, 22173, 22125, + 22078, 22031, 21983, 21936, 21889, 21841, 21794, 21746, + 21699, 21651, 21604, 21557, 21509, 21462, 21414, 21367, + 21319, 21271, 21224, 21176, 21129, 21081, 21034, 20986, + 20938, 20891, 20843, 20795, 20748, 20700, 20652, 20605, + 20557, 20509, 20461, 20414, 20366, 20318, 20270, 20223, + 20175, 20127, 20079, 20031, 19983, 19935, 19888, 19840, + 19792, 19744, 19696, 19648, 19600, 19552, 19504, 19456, + 19408, 19360, 19312, 19264, 19216, 19168, 19120, 19072, + 19024, 18975, 18927, 18879, 18831, 18783, 18735, 18687, + 18638, 18590, 18542, 18494, 18446, 18397, 18349, 18301, + 18253, 18204, 18156, 18108, 18059, 18011, 17963, 17914, + 17866, 17818, 17769, 17721, 17672, 17624, 17576, 17527, + 17479, 17430, 17382, 17333, 17285, 17236, 17188, 17139, + 17091, 17042, 16994, 16945, 16897, 16848, 16800, 16751, + 16702, 16654, 16605, 16557, 16508, 16459, 16411, 16362, + 16313, 16265, 16216, 16167, 16118, 16070, 16021, 15972, + 15923, 15875, 15826, 15777, 15728, 15680, 15631, 15582, + 15533, 15484, 15435, 15387, 15338, 15289, 15240, 15191, + 15142, 15093, 15044, 14995, 14946, 14897, 14849, 14800, + 14751, 14702, 14653, 14604, 14555, 14506, 14457, 14408, + 14359, 14309, 14260, 14211, 14162, 14113, 14064, 14015, + 13966, 13917, 13868, 13819, 13769, 13720, 13671, 13622, + 13573, 13524, 13474, 13425, 13376, 13327, 13278, 13228, + 13179, 13130, 13081, 13031, 12982, 12933, 12884, 12834, + 12785, 12736, 12686, 12637, 12588, 12538, 12489, 12440, + 12390, 12341, 12292, 12242, 12193, 12143, 12094, 12045, + 11995, 11946, 11896, 11847, 11797, 11748, 11699, 11649, + 11600, 11550, 11501, 11451, 11402, 11352, 11303, 11253, + 11204, 11154, 11105, 11055, 11006, 10956, 10906, 10857, + 10807, 10758, 10708, 10658, 10609, 10559, 10510, 10460, + 10410, 10361, 10311, 10262, 10212, 10162, 10113, 10063, + 10013, 9964, 9914, 9864, 9814, 9765, 9715, 9665, + 9616, 9566, 9516, 9466, 9417, 9367, 9317, 9267, + 9218, 9168, 9118, 9068, 9019, 8969, 8919, 8869, + 8819, 8770, 8720, 8670, 8620, 8570, 8520, 8471, + 8421, 8371, 8321, 8271, 8221, 8171, 8122, 8072, + 8022, 7972, 7922, 7872, 7822, 7772, 7722, 7672, + 7623, 7573, 7523, 7473, 7423, 7373, 7323, 7273, + 7223, 7173, 7123, 7073, 7023, 6973, 6923, 6873, + 6823, 6773, 6723, 6673, 6623, 6573, 6523, 6473, + 6423, 6373, 6323, 6273, 6223, 6173, 6123, 6073, + 6023, 5973, 5923, 5873, 5823, 5773, 5722, 5672, + 5622, 5572, 5522, 5472, 5422, 5372, 5322, 5272, + 5222, 5171, 5121, 5071, 5021, 4971, 4921, 4871, + 4821, 4770, 4720, 4670, 4620, 4570, 4520, 4470, + 4420, 4369, 4319, 4269, 4219, 4169, 4119, 4068, + 4018, 3968, 3918, 3868, 3818, 3767, 3717, 3667, + 3617, 3567, 3516, 3466, 3416, 3366, 3316, 3265, + 3215, 3165, 3115, 3065, 3014, 2964, 2914, 2864, + 2814, 2763, 2713, 2663, 2613, 2562, 2512, 2462, + 2412, 2361, 2311, 2261, 2211, 2161, 2110, 2060, + 2010, 1960, 1909, 1859, 1809, 1759, 1708, 1658, + 1608, 1558, 1507, 1457, 1407, 1357, 1306, 1256, + 1206, 1156, 1105, 1055, 1005, 955, 904, 854, + 804, 753, 703, 653, 603, 552, 502, 452, + 402, 351, 301, 251, 201, 150, 100, 50, + 0, -50, -100, -150, -201, -251, -301, -351, + -402, -452, -502, -552, -603, -653, -703, -753, + -804, -854, -904, -955, -1005, -1055, -1105, -1156, + -1206, -1256, -1306, -1357, -1407, -1457, -1507, -1558, + -1608, -1658, -1708, -1759, -1809, -1859, -1909, -1960, + -2010, -2060, -2110, -2161, -2211, -2261, -2311, -2361, + -2412, -2462, -2512, -2562, -2613, -2663, -2713, -2763, + -2814, -2864, -2914, -2964, -3014, -3065, -3115, -3165, + -3215, -3265, -3316, -3366, -3416, -3466, -3516, -3567, + -3617, -3667, -3717, -3767, -3818, -3868, -3918, -3968, + -4018, -4068, -4119, -4169, -4219, -4269, -4319, -4369, + -4420, -4470, -4520, -4570, -4620, -4670, -4720, -4770, + -4821, -4871, -4921, -4971, -5021, -5071, -5121, -5171, + -5222, -5272, -5322, -5372, -5422, -5472, -5522, -5572, + -5622, -5672, -5722, -5773, -5823, -5873, -5923, -5973, + -6023, -6073, -6123, -6173, -6223, -6273, -6323, -6373, + -6423, -6473, -6523, -6573, -6623, -6673, -6723, -6773, + -6823, -6873, -6923, -6973, -7023, -7073, -7123, -7173, + -7223, -7273, -7323, -7373, -7423, -7473, -7523, -7573, + -7623, -7672, -7722, -7772, -7822, -7872, -7922, -7972, + -8022, -8072, -8122, -8171, -8221, -8271, -8321, -8371, + -8421, -8471, -8520, -8570, -8620, -8670, -8720, -8770, + -8819, -8869, -8919, -8969, -9019, -9068, -9118, -9168, + -9218, -9267, -9317, -9367, -9417, -9466, -9516, -9566, + -9616, -9665, -9715, -9765, -9814, -9864, -9914, -9964, + -10013, -10063, -10113, -10162, -10212, -10262, -10311, -10361, + -10410, -10460, -10510, -10559, -10609, -10658, -10708, -10758, + -10807, -10857, -10906, -10956, -11006, -11055, -11105, -11154, + -11204, -11253, -11303, -11352, -11402, -11451, -11501, -11550, + -11600, -11649, -11699, -11748, -11797, -11847, -11896, -11946, + -11995, -12045, -12094, -12143, -12193, -12242, -12292, -12341, + -12390, -12440, -12489, -12538, -12588, -12637, -12686, -12736, + -12785, -12834, -12884, -12933, -12982, -13031, -13081, -13130, + -13179, -13228, -13278, -13327, -13376, -13425, -13474, -13524, + -13573, -13622, -13671, -13720, -13769, -13819, -13868, -13917, + -13966, -14015, -14064, -14113, -14162, -14211, -14260, -14309, + -14359, -14408, -14457, -14506, -14555, -14604, -14653, -14702, + -14751, -14800, -14849, -14897, -14946, -14995, -15044, -15093, + -15142, -15191, -15240, -15289, -15338, -15387, -15435, -15484, + -15533, -15582, -15631, -15680, -15728, -15777, -15826, -15875, + -15923, -15972, -16021, -16070, -16118, -16167, -16216, -16265, + -16313, -16362, -16411, -16459, -16508, -16557, -16605, -16654, + -16702, -16751, -16800, -16848, -16897, -16945, -16994, -17042, + -17091, -17139, -17188, -17236, -17285, -17333, -17382, -17430, + -17479, -17527, -17576, -17624, -17672, -17721, -17769, -17818, + -17866, -17914, -17963, -18011, -18059, -18108, -18156, -18204, + -18253, -18301, -18349, -18397, -18446, -18494, -18542, -18590, + -18638, -18687, -18735, -18783, -18831, -18879, -18927, -18975, + -19024, -19072, -19120, -19168, -19216, -19264, -19312, -19360, + -19408, -19456, -19504, -19552, -19600, -19648, -19696, -19744, + -19792, -19840, -19888, -19935, -19983, -20031, -20079, -20127, + -20175, -20223, -20270, -20318, -20366, -20414, -20461, -20509, + -20557, -20605, -20652, -20700, -20748, -20795, -20843, -20891, + -20938, -20986, -21034, -21081, -21129, -21176, -21224, -21271, + -21319, -21367, -21414, -21462, -21509, -21557, -21604, -21651, + -21699, -21746, -21794, -21841, -21889, -21936, -21983, -22031, + -22078, -22125, -22173, -22220, -22267, -22314, -22362, -22409, + -22456, -22503, -22551, -22598, -22645, -22692, -22739, -22786, + -22833, -22881, -22928, -22975, -23022, -23069, -23116, -23163, + -23210, -23257, -23304, -23351, -23398, -23445, -23492, -23539, + -23586, -23632, -23679, -23726, -23773, -23820, -23867, -23914, + -23960, -24007, -24054, -24101, -24147, -24194, -24241, -24287, + -24334, -24381, -24427, -24474, -24521, -24567, -24614, -24660, + -24707, -24754, -24800, -24847, -24893, -24940, -24986, -25033, + -25079, -25125, -25172, -25218, -25265, -25311, -25357, -25404, + -25450, -25496, -25543, -25589, -25635, -25681, -25728, -25774, + -25820, -25866, -25913, -25959, -26005, -26051, -26097, -26143, + -26189, -26235, -26281, -26327, -26373, -26419, -26465, -26511, + -26557, -26603, -26649, -26695, -26741, -26787, -26833, -26879, + -26925, -26970, -27016, -27062, -27108, -27153, -27199, -27245, + -27291, -27336, -27382, -27428, -27473, -27519, -27565, -27610, + -27656, -27701, -27747, -27792, -27838, -27883, -27929, -27974, + -28020, -28065, -28111, -28156, -28201, -28247, -28292, -28337, + -28383, -28428, -28473, -28519, -28564, -28609, -28654, -28699, + -28745, -28790, -28835, -28880, -28925, -28970, -29015, -29060, + -29105, -29151, -29196, -29241, -29285, -29330, -29375, -29420, + -29465, -29510, -29555, -29600, -29645, -29690, -29734, -29779, + -29824, -29869, -29913, -29958, -30003, -30047, -30092, -30137, + -30181, -30226, -30271, -30315, -30360, -30404, -30449, -30493, + -30538, -30582, -30627, -30671, -30715, -30760, -30804, -30849, + -30893, -30937, -30982, -31026, -31070, -31114, -31159, -31203, + -31247, -31291, -31335, -31379, -31424, -31468, -31512, -31556, + -31600, -31644, -31688, -31732, -31776, -31820, -31864, -31908, + -31952, -31995, -32039, -32083, -32127, -32171, -32215, -32258, + -32302, -32346, -32390, -32433, -32477, -32521, -32564, -32608, + -32651, -32695, -32738, -32782, -32826, -32869, -32912, -32956, + -32999, -33043, -33086, -33130, -33173, -33216, -33260, -33303, + -33346, -33389, -33433, -33476, -33519, -33562, -33605, -33649, + -33692, -33735, -33778, -33821, -33864, -33907, -33950, -33993, + -34036, -34079, -34122, -34165, -34208, -34251, -34293, -34336, + -34379, -34422, -34465, -34507, -34550, -34593, -34635, -34678, + -34721, -34763, -34806, -34849, -34891, -34934, -34976, -35019, + -35061, -35104, -35146, -35188, -35231, -35273, -35316, -35358, + -35400, -35442, -35485, -35527, -35569, -35611, -35654, -35696, + -35738, -35780, -35822, -35864, -35906, -35948, -35990, -36032, + -36074, -36116, -36158, -36200, -36242, -36284, -36326, -36368, + -36409, -36451, -36493, -36535, -36576, -36618, -36660, -36701, + -36743, -36785, -36826, -36868, -36909, -36951, -36992, -37034, + -37075, -37117, -37158, -37200, -37241, -37282, -37324, -37365, + -37406, -37447, -37489, -37530, -37571, -37612, -37653, -37695, + -37736, -37777, -37818, -37859, -37900, -37941, -37982, -38023, + -38064, -38105, -38146, -38186, -38227, -38268, -38309, -38350, + -38390, -38431, -38472, -38512, -38553, -38594, -38634, -38675, + -38716, -38756, -38797, -38837, -38878, -38918, -38958, -38999, + -39039, -39080, -39120, -39160, -39201, -39241, -39281, -39321, + -39362, -39402, -39442, -39482, -39522, -39562, -39602, -39642, + -39682, -39722, -39762, -39802, -39842, -39882, -39922, -39962, + -40002, -40041, -40081, -40121, -40161, -40200, -40240, -40280, + -40319, -40359, -40399, -40438, -40478, -40517, -40557, -40596, + -40636, -40675, -40714, -40754, -40793, -40832, -40872, -40911, + -40950, -40990, -41029, -41068, -41107, -41146, -41185, -41224, + -41263, -41303, -41342, -41381, -41419, -41458, -41497, -41536, + -41575, -41614, -41653, -41692, -41730, -41769, -41808, -41846, + -41885, -41924, -41962, -42001, -42040, -42078, -42117, -42155, + -42194, -42232, -42271, -42309, -42347, -42386, -42424, -42462, + -42501, -42539, -42577, -42615, -42653, -42692, -42730, -42768, + -42806, -42844, -42882, -42920, -42958, -42996, -43034, -43072, + -43110, -43147, -43185, -43223, -43261, -43298, -43336, -43374, + -43412, -43449, -43487, -43524, -43562, -43600, -43637, -43675, + -43712, -43749, -43787, -43824, -43862, -43899, -43936, -43974, + -44011, -44048, -44085, -44122, -44160, -44197, -44234, -44271, + -44308, -44345, -44382, -44419, -44456, -44493, -44530, -44567, + -44603, -44640, -44677, -44714, -44750, -44787, -44824, -44861, + -44897, -44934, -44970, -45007, -45043, -45080, -45116, -45153, + -45189, -45226, -45262, -45298, -45335, -45371, -45407, -45443, + -45480, -45516, -45552, -45588, -45624, -45660, -45696, -45732, + -45768, -45804, -45840, -45876, -45912, -45948, -45984, -46019, + -46055, -46091, -46127, -46162, -46198, -46234, -46269, -46305, + -46340, -46376, -46411, -46447, -46482, -46518, -46553, -46589, + -46624, -46659, -46695, -46730, -46765, -46800, -46835, -46871, + -46906, -46941, -46976, -47011, -47046, -47081, -47116, -47151, + -47186, -47220, -47255, -47290, -47325, -47360, -47394, -47429, + -47464, -47498, -47533, -47568, -47602, -47637, -47671, -47706, + -47740, -47775, -47809, -47843, -47878, -47912, -47946, -47981, + -48015, -48049, -48083, -48117, -48151, -48185, -48219, -48254, + -48288, -48321, -48355, -48389, -48423, -48457, -48491, -48525, + -48558, -48592, -48626, -48660, -48693, -48727, -48760, -48794, + -48828, -48861, -48895, -48928, -48961, -48995, -49028, -49062, + -49095, -49128, -49161, -49195, -49228, -49261, -49294, -49327, + -49360, -49393, -49426, -49459, -49492, -49525, -49558, -49591, + -49624, -49657, -49690, -49722, -49755, -49788, -49820, -49853, + -49886, -49918, -49951, -49983, -50016, -50048, -50081, -50113, + -50146, -50178, -50210, -50242, -50275, -50307, -50339, -50371, + -50403, -50436, -50468, -50500, -50532, -50564, -50596, -50628, + -50660, -50691, -50723, -50755, -50787, -50819, -50850, -50882, + -50914, -50945, -50977, -51008, -51040, -51072, -51103, -51134, + -51166, -51197, -51229, -51260, -51291, -51323, -51354, -51385, + -51416, -51447, -51478, -51510, -51541, -51572, -51603, -51634, + -51665, -51695, -51726, -51757, -51788, -51819, -51850, -51880, + -51911, -51942, -51972, -52003, -52033, -52064, -52095, -52125, + -52155, -52186, -52216, -52247, -52277, -52307, -52338, -52368, + -52398, -52428, -52458, -52488, -52518, -52549, -52579, -52609, + -52639, -52668, -52698, -52728, -52758, -52788, -52818, -52847, + -52877, -52907, -52936, -52966, -52996, -53025, -53055, -53084, + -53114, -53143, -53172, -53202, -53231, -53260, -53290, -53319, + -53348, -53377, -53407, -53436, -53465, -53494, -53523, -53552, + -53581, -53610, -53639, -53667, -53696, -53725, -53754, -53783, + -53811, -53840, -53869, -53897, -53926, -53954, -53983, -54011, + -54040, -54068, -54097, -54125, -54153, -54182, -54210, -54238, + -54266, -54294, -54323, -54351, -54379, -54407, -54435, -54463, + -54491, -54519, -54546, -54574, -54602, -54630, -54658, -54685, + -54713, -54741, -54768, -54796, -54823, -54851, -54879, -54906, + -54933, -54961, -54988, -55015, -55043, -55070, -55097, -55124, + -55152, -55179, -55206, -55233, -55260, -55287, -55314, -55341, + -55368, -55395, -55422, -55448, -55475, -55502, -55529, -55555, + -55582, -55609, -55635, -55662, -55688, -55715, -55741, -55768, + -55794, -55820, -55847, -55873, -55899, -55925, -55952, -55978, + -56004, -56030, -56056, -56082, -56108, -56134, -56160, -56186, + -56212, -56237, -56263, -56289, -56315, -56340, -56366, -56392, + -56417, -56443, -56468, -56494, -56519, -56545, -56570, -56595, + -56621, -56646, -56671, -56697, -56722, -56747, -56772, -56797, + -56822, -56847, -56872, -56897, -56922, -56947, -56972, -56997, + -57022, -57046, -57071, -57096, -57120, -57145, -57170, -57194, + -57219, -57243, -57268, -57292, -57316, -57341, -57365, -57389, + -57414, -57438, -57462, -57486, -57510, -57534, -57558, -57582, + -57606, -57630, -57654, -57678, -57702, -57726, -57750, -57773, + -57797, -57821, -57844, -57868, -57892, -57915, -57939, -57962, + -57986, -58009, -58032, -58056, -58079, -58102, -58125, -58149, + -58172, -58195, -58218, -58241, -58264, -58287, -58310, -58333, + -58356, -58379, -58402, -58424, -58447, -58470, -58493, -58515, + -58538, -58560, -58583, -58605, -58628, -58650, -58673, -58695, + -58718, -58740, -58762, -58784, -58807, -58829, -58851, -58873, + -58895, -58917, -58939, -58961, -58983, -59005, -59027, -59049, + -59070, -59092, -59114, -59135, -59157, -59179, -59200, -59222, + -59243, -59265, -59286, -59308, -59329, -59350, -59372, -59393, + -59414, -59435, -59457, -59478, -59499, -59520, -59541, -59562, + -59583, -59604, -59625, -59645, -59666, -59687, -59708, -59728, + -59749, -59770, -59790, -59811, -59831, -59852, -59872, -59893, + -59913, -59934, -59954, -59974, -59994, -60015, -60035, -60055, + -60075, -60095, -60115, -60135, -60155, -60175, -60195, -60215, + -60235, -60254, -60274, -60294, -60313, -60333, -60353, -60372, + -60392, -60411, -60431, -60450, -60470, -60489, -60508, -60528, + -60547, -60566, -60585, -60604, -60624, -60643, -60662, -60681, + -60700, -60719, -60737, -60756, -60775, -60794, -60813, -60831, + -60850, -60869, -60887, -60906, -60924, -60943, -60961, -60980, + -60998, -61017, -61035, -61053, -61071, -61090, -61108, -61126, + -61144, -61162, -61180, -61198, -61216, -61234, -61252, -61270, + -61288, -61305, -61323, -61341, -61359, -61376, -61394, -61411, + -61429, -61446, -61464, -61481, -61499, -61516, -61533, -61551, + -61568, -61585, -61602, -61619, -61637, -61654, -61671, -61688, + -61705, -61721, -61738, -61755, -61772, -61789, -61805, -61822, + -61839, -61855, -61872, -61889, -61905, -61922, -61938, -61954, + -61971, -61987, -62003, -62020, -62036, -62052, -62068, -62084, + -62100, -62117, -62133, -62148, -62164, -62180, -62196, -62212, + -62228, -62244, -62259, -62275, -62291, -62306, -62322, -62337, + -62353, -62368, -62384, -62399, -62414, -62430, -62445, -62460, + -62475, -62491, -62506, -62521, -62536, -62551, -62566, -62581, + -62596, -62610, -62625, -62640, -62655, -62670, -62684, -62699, + -62714, -62728, -62743, -62757, -62772, -62786, -62800, -62815, + -62829, -62843, -62858, -62872, -62886, -62900, -62914, -62928, + -62942, -62956, -62970, -62984, -62998, -63012, -63026, -63039, + -63053, -63067, -63080, -63094, -63108, -63121, -63135, -63148, + -63162, -63175, -63188, -63202, -63215, -63228, -63241, -63254, + -63268, -63281, -63294, -63307, -63320, -63333, -63346, -63358, + -63371, -63384, -63397, -63410, -63422, -63435, -63447, -63460, + -63473, -63485, -63498, -63510, -63522, -63535, -63547, -63559, + -63571, -63584, -63596, -63608, -63620, -63632, -63644, -63656, + -63668, -63680, -63692, -63704, -63715, -63727, -63739, -63750, + -63762, -63774, -63785, -63797, -63808, -63820, -63831, -63842, + -63854, -63865, -63876, -63888, -63899, -63910, -63921, -63932, + -63943, -63954, -63965, -63976, -63987, -63998, -64009, -64019, + -64030, -64041, -64051, -64062, -64073, -64083, -64094, -64104, + -64115, -64125, -64135, -64146, -64156, -64166, -64176, -64186, + -64197, -64207, -64217, -64227, -64237, -64247, -64257, -64266, + -64276, -64286, -64296, -64305, -64315, -64325, -64334, -64344, + -64353, -64363, -64372, -64382, -64391, -64401, -64410, -64419, + -64428, -64437, -64447, -64456, -64465, -64474, -64483, -64492, + -64501, -64510, -64518, -64527, -64536, -64545, -64553, -64562, + -64571, -64579, -64588, -64596, -64605, -64613, -64622, -64630, + -64638, -64646, -64655, -64663, -64671, -64679, -64687, -64695, + -64703, -64711, -64719, -64727, -64735, -64743, -64751, -64758, + -64766, -64774, -64781, -64789, -64796, -64804, -64811, -64819, + -64826, -64834, -64841, -64848, -64855, -64863, -64870, -64877, + -64884, -64891, -64898, -64905, -64912, -64919, -64926, -64933, + -64939, -64946, -64953, -64959, -64966, -64973, -64979, -64986, + -64992, -64999, -65005, -65011, -65018, -65024, -65030, -65036, + -65043, -65049, -65055, -65061, -65067, -65073, -65079, -65085, + -65091, -65096, -65102, -65108, -65114, -65119, -65125, -65131, + -65136, -65142, -65147, -65153, -65158, -65163, -65169, -65174, + -65179, -65184, -65190, -65195, -65200, -65205, -65210, -65215, + -65220, -65225, -65230, -65235, -65239, -65244, -65249, -65253, + -65258, -65263, -65267, -65272, -65276, -65281, -65285, -65290, + -65294, -65298, -65302, -65307, -65311, -65315, -65319, -65323, + -65327, -65331, -65335, -65339, -65343, -65347, -65350, -65354, + -65358, -65362, -65365, -65369, -65372, -65376, -65379, -65383, + -65386, -65390, -65393, -65396, -65400, -65403, -65406, -65409, + -65412, -65415, -65418, -65421, -65424, -65427, -65430, -65433, + -65436, -65438, -65441, -65444, -65446, -65449, -65452, -65454, + -65457, -65459, -65461, -65464, -65466, -65468, -65471, -65473, + -65475, -65477, -65479, -65481, -65483, -65485, -65487, -65489, + -65491, -65493, -65495, -65496, -65498, -65500, -65501, -65503, + -65505, -65506, -65508, -65509, -65511, -65512, -65513, -65515, + -65516, -65517, -65518, -65519, -65520, -65521, -65522, -65523, + -65524, -65525, -65526, -65527, -65528, -65529, -65529, -65530, -65531, -65531, -65532, -65532, -65533, -65533, -65534, -65534, -65534, -65535, -65535, -65535, -65535, -65535, -65535, -65535, - -65535, -65535, -65535, -65535, -65535, -65535, -65535, -65534, - -65534, -65534, -65533, -65533, -65532, -65532, -65531, -65531, - -65530, -65530, -65529, -65528, -65527, -65527, -65526, -65525, - -65524, -65523, -65522, -65521, -65520, -65519, -65518, -65516, - -65515, -65514, -65513, -65511, -65510, -65508, -65507, -65505, - -65504, -65502, -65501, -65499, -65497, -65496, -65494, -65492, - -65490, -65488, -65486, -65484, -65482, -65480, -65478, -65476, - -65474, -65472, -65470, -65467, -65465, -65463, -65460, -65458, - -65455, -65453, -65450, -65448, -65445, -65442, -65440, -65437, - -65434, -65431, -65429, -65426, -65423, -65420, -65417, -65414, - -65411, -65408, -65404, -65401, -65398, -65395, -65391, -65388, - -65385, -65381, -65378, -65374, -65371, -65367, -65363, -65360, - -65356, -65352, -65349, -65345, -65341, -65337, -65333, -65329, - -65325, -65321, -65317, -65313, -65309, -65305, -65300, -65296, - -65292, -65287, -65283, -65279, -65274, -65270, -65265, -65260, - -65256, -65251, -65246, -65242, -65237, -65232, -65227, -65222, - -65217, -65212, -65207, -65202, -65197, -65192, -65187, -65182, - -65177, -65171, -65166, -65161, -65155, -65150, -65144, -65139, - -65133, -65128, -65122, -65117, -65111, -65105, -65099, -65094, - -65088, -65082, -65076, -65070, -65064, -65058, -65052, -65046, - -65040, -65033, -65027, -65021, -65015, -65008, -65002, -64995, - -64989, -64982, -64976, -64969, -64963, -64956, -64949, -64943, - -64936, -64929, -64922, -64915, -64908, -64902, -64895, -64887, - -64880, -64873, -64866, -64859, -64852, -64844, -64837, -64830, - -64822, -64815, -64808, -64800, -64793, -64785, -64777, -64770, - -64762, -64754, -64747, -64739, -64731, -64723, -64715, -64707, - -64699, -64691, -64683, -64675, -64667, -64659, -64651, -64642, - -64634, -64626, -64617, -64609, -64601, -64592, -64584, -64575, - -64566, -64558, -64549, -64540, -64532, -64523, -64514, -64505, - -64496, -64487, -64478, -64469, -64460, -64451, -64442, -64433, - -64424, -64414, -64405, -64396, -64387, -64377, -64368, -64358, - -64349, -64339, -64330, -64320, -64310, -64301, -64291, -64281, - -64271, -64261, -64252, -64242, -64232, -64222, -64212, -64202, - -64192, -64181, -64171, -64161, -64151, -64140, -64130, -64120, - -64109, -64099, -64088, -64078, -64067, -64057, -64046, -64035, - -64025, -64014, -64003, -63992, -63981, -63971, -63960, -63949, - -63938, -63927, -63915, -63904, -63893, -63882, -63871, -63859, - -63848, -63837, -63825, -63814, -63803, -63791, -63779, -63768, - -63756, -63745, -63733, -63721, -63709, -63698, -63686, -63674, - -63662, -63650, -63638, -63626, -63614, -63602, -63590, -63578, - -63565, -63553, -63541, -63528, -63516, -63504, -63491, -63479, - -63466, -63454, -63441, -63429, -63416, -63403, -63390, -63378, - -63365, -63352, -63339, -63326, -63313, -63300, -63287, -63274, - -63261, -63248, -63235, -63221, -63208, -63195, -63182, -63168, - -63155, -63141, -63128, -63114, -63101, -63087, -63074, -63060, - -63046, -63032, -63019, -63005, -62991, -62977, -62963, -62949, - -62935, -62921, -62907, -62893, -62879, -62865, -62850, -62836, - -62822, -62808, -62793, -62779, -62764, -62750, -62735, -62721, - -62706, -62692, -62677, -62662, -62648, -62633, -62618, -62603, - -62588, -62573, -62558, -62543, -62528, -62513, -62498, -62483, - -62468, -62453, -62437, -62422, -62407, -62391, -62376, -62360, - -62345, -62329, -62314, -62298, -62283, -62267, -62251, -62236, - -62220, -62204, -62188, -62172, -62156, -62141, -62125, -62108, - -62092, -62076, -62060, -62044, -62028, -62012, -61995, -61979, - -61963, -61946, -61930, -61913, -61897, -61880, -61864, -61847, - -61831, -61814, -61797, -61780, -61764, -61747, -61730, -61713, - -61696, -61679, -61662, -61645, -61628, -61611, -61594, -61577, - -61559, -61542, -61525, -61507, -61490, -61473, -61455, -61438, - -61420, -61403, -61385, -61367, -61350, -61332, -61314, -61297, - -61279, -61261, -61243, -61225, -61207, -61189, -61171, -61153, - -61135, -61117, -61099, -61081, -61062, -61044, -61026, -61007, - -60989, -60971, -60952, -60934, -60915, -60897, -60878, -60859, - -60841, -60822, -60803, -60785, -60766, -60747, -60728, -60709, - -60690, -60671, -60652, -60633, -60614, -60595, -60576, -60556, - -60537, -60518, -60499, -60479, -60460, -60441, -60421, -60402, - -60382, -60363, -60343, -60323, -60304, -60284, -60264, -60244, - -60225, -60205, -60185, -60165, -60145, -60125, -60105, -60085, - -60065, -60045, -60025, -60004, -59984, -59964, -59944, -59923, - -59903, -59883, -59862, -59842, -59821, -59801, -59780, -59759, - -59739, -59718, -59697, -59677, -59656, -59635, -59614, -59593, - -59572, -59551, -59530, -59509, -59488, -59467, -59446, -59425, - -59404, -59382, -59361, -59340, -59318, -59297, -59276, -59254, - -59233, -59211, -59189, -59168, -59146, -59125, -59103, -59081, - -59059, -59038, -59016, -58994, -58972, -58950, -58928, -58906, - -58884, -58862, -58840, -58818, -58795, -58773, -58751, -58729, - -58706, -58684, -58662, -58639, -58617, -58594, -58572, -58549, - -58527, -58504, -58481, -58459, -58436, -58413, -58390, -58367, - -58345, -58322, -58299, -58276, -58253, -58230, -58207, -58183, - -58160, -58137, -58114, -58091, -58067, -58044, -58021, -57997, - -57974, -57950, -57927, -57903, -57880, -57856, -57833, -57809, - -57785, -57762, -57738, -57714, -57690, -57666, -57642, -57618, - -57594, -57570, -57546, -57522, -57498, -57474, -57450, -57426, - -57402, -57377, -57353, -57329, -57304, -57280, -57255, -57231, - -57206, -57182, -57157, -57133, -57108, -57083, -57059, -57034, - -57009, -56984, -56959, -56935, -56910, -56885, -56860, -56835, - -56810, -56785, -56760, -56734, -56709, -56684, -56659, -56633, - -56608, -56583, -56557, -56532, -56507, -56481, -56456, -56430, - -56404, -56379, -56353, -56328, -56302, -56276, -56250, -56225, - -56199, -56173, -56147, -56121, -56095, -56069, -56043, -56017, - -55991, -55965, -55938, -55912, -55886, -55860, -55833, -55807, - -55781, -55754, -55728, -55701, -55675, -55648, -55622, -55595, - -55569, -55542, -55515, -55489, -55462, -55435, -55408, -55381, - -55354, -55327, -55300, -55274, -55246, -55219, -55192, -55165, - -55138, -55111, -55084, -55056, -55029, -55002, -54974, -54947, - -54920, -54892, -54865, -54837, -54810, -54782, -54755, -54727, - -54699, -54672, -54644, -54616, -54588, -54560, -54533, -54505, - -54477, -54449, -54421, -54393, -54365, -54337, -54308, -54280, - -54252, -54224, -54196, -54167, -54139, -54111, -54082, -54054, - -54026, -53997, -53969, -53940, -53911, -53883, -53854, -53826, - -53797, -53768, -53739, -53711, -53682, -53653, -53624, -53595, - -53566, -53537, -53508, -53479, -53450, -53421, -53392, -53363, - -53334, -53304, -53275, -53246, -53216, -53187, -53158, -53128, - -53099, -53069, -53040, -53010, -52981, -52951, -52922, -52892, - -52862, -52832, -52803, -52773, -52743, -52713, -52683, -52653, - -52624, -52594, -52564, -52534, -52503, -52473, -52443, -52413, - -52383, -52353, -52322, -52292, -52262, -52231, -52201, -52171, - -52140, -52110, -52079, -52049, -52018, -51988, -51957, -51926, - -51896, -51865, -51834, -51803, -51773, -51742, -51711, -51680, - -51649, -51618, -51587, -51556, -51525, -51494, -51463, -51432, - -51401, -51369, -51338, -51307, -51276, -51244, -51213, -51182, - -51150, -51119, -51087, -51056, -51024, -50993, -50961, -50929, - -50898, -50866, -50834, -50803, -50771, -50739, -50707, -50675, - -50644, -50612, -50580, -50548, -50516, -50484, -50452, -50420, - -50387, -50355, -50323, -50291, -50259, -50226, -50194, -50162, - -50129, -50097, -50065, -50032, -50000, -49967, -49935, -49902, - -49869, -49837, -49804, -49771, -49739, -49706, -49673, -49640, - -49608, -49575, -49542, -49509, -49476, -49443, -49410, -49377, - -49344, -49311, -49278, -49244, -49211, -49178, -49145, -49112, - -49078, -49045, -49012, -48978, -48945, -48911, -48878, -48844, - -48811, -48777, -48744, -48710, -48676, -48643, -48609, -48575, - -48542, -48508, -48474, -48440, -48406, -48372, -48338, -48305, - -48271, -48237, -48202, -48168, -48134, -48100, -48066, -48032, - -47998, -47963, -47929, -47895, -47860, -47826, -47792, -47757, - -47723, -47688, -47654, -47619, -47585, -47550, -47516, -47481, - -47446, -47412, -47377, -47342, -47307, -47273, -47238, -47203, - -47168, -47133, -47098, -47063, -47028, -46993, -46958, -46923, - -46888, -46853, -46818, -46783, -46747, -46712, -46677, -46642, - -46606, -46571, -46536, -46500, -46465, -46429, -46394, -46358, - -46323, -46287, -46251, -46216, -46180, -46145, -46109, -46073, - -46037, -46002, -45966, -45930, -45894, -45858, -45822, -45786, - -45750, -45714, -45678, -45642, -45606, -45570, -45534, -45498, - -45462, -45425, -45389, -45353, -45316, -45280, -45244, -45207, - -45171, -45135, -45098, -45062, -45025, -44989, -44952, -44915, - -44879, -44842, -44806, -44769, -44732, -44695, -44659, -44622, - -44585, -44548, -44511, -44474, -44437, -44400, -44363, -44326, - -44289, -44252, -44215, -44178, -44141, -44104, -44067, -44029, - -43992, -43955, -43918, -43880, -43843, -43806, -43768, -43731, - -43693, -43656, -43618, -43581, -43543, -43506, -43468, -43430, - -43393, -43355, -43317, -43280, -43242, -43204, -43166, -43128, - -43091, -43053, -43015, -42977, -42939, -42901, -42863, -42825, - -42787, -42749, -42711, -42672, -42634, -42596, -42558, -42520, - -42481, -42443, -42405, -42366, -42328, -42290, -42251, -42213, - -42174, -42136, -42097, -42059, -42020, -41982, -41943, -41904, - -41866, -41827, -41788, -41750, -41711, -41672, -41633, -41595, - -41556, -41517, -41478, -41439, -41400, -41361, -41322, -41283, - -41244, -41205, -41166, -41127, -41087, -41048, -41009, -40970, - -40931, -40891, -40852, -40813, -40773, -40734, -40695, -40655, - -40616, -40576, -40537, -40497, -40458, -40418, -40379, -40339, - -40299, -40260, -40220, -40180, -40141, -40101, -40061, -40021, - -39982, -39942, -39902, -39862, -39822, -39782, -39742, -39702, - -39662, -39622, -39582, -39542, -39502, -39462, -39422, -39382, - -39341, -39301, -39261, -39221, -39180, -39140, -39100, -39059, - -39019, -38979, -38938, -38898, -38857, -38817, -38776, -38736, - -38695, -38655, -38614, -38573, -38533, -38492, -38451, -38411, - -38370, -38329, -38288, -38248, -38207, -38166, -38125, -38084, - -38043, -38002, -37961, -37920, -37879, -37838, -37797, -37756, - -37715, -37674, -37633, -37592, -37550, -37509, -37468, -37427, - -37386, -37344, -37303, -37262, -37220, -37179, -37137, -37096, - -37055, -37013, -36972, -36930, -36889, -36847, -36805, -36764, - -36722, -36681, -36639, -36597, -36556, -36514, -36472, -36430, - -36388, -36347, -36305, -36263, -36221, -36179, -36137, -36095, - -36053, -36011, -35969, -35927, -35885, -35843, -35801, -35759, - -35717, -35675, -35633, -35590, -35548, -35506, -35464, -35421, - -35379, -35337, -35294, -35252, -35210, -35167, -35125, -35082, - -35040, -34997, -34955, -34912, -34870, -34827, -34785, -34742, - -34699, -34657, -34614, -34571, -34529, -34486, -34443, -34400, - -34358, -34315, -34272, -34229, -34186, -34143, -34100, -34057, - -34015, -33972, -33929, -33886, -33843, -33799, -33756, -33713, - -33670, -33627, -33584, -33541, -33498, -33454, -33411, -33368, - -33325, -33281, -33238, -33195, -33151, -33108, -33065, -33021, - -32978, -32934, -32891, -32847, -32804, -32760, -32717, -32673, - -32630, -32586, -32542, -32499, -32455, -32411, -32368, -32324, - -32280, -32236, -32193, -32149, -32105, -32061, -32017, -31974, - -31930, -31886, -31842, -31798, -31754, -31710, -31666, -31622, - -31578, -31534, -31490, -31446, -31402, -31357, -31313, -31269, - -31225, -31181, -31136, -31092, -31048, -31004, -30959, -30915, - -30871, -30826, -30782, -30738, -30693, -30649, -30604, -30560, - -30515, -30471, -30426, -30382, -30337, -30293, -30248, -30204, - -30159, -30114, -30070, -30025, -29980, -29936, -29891, -29846, - -29801, -29757, -29712, -29667, -29622, -29577, -29533, -29488, - -29443, -29398, -29353, -29308, -29263, -29218, -29173, -29128, - -29083, -29038, -28993, -28948, -28903, -28858, -28812, -28767, - -28722, -28677, -28632, -28586, -28541, -28496, -28451, -28405, - -28360, -28315, -28269, -28224, -28179, -28133, -28088, -28042, - -27997, -27952, -27906, -27861, -27815, -27770, -27724, -27678, - -27633, -27587, -27542, -27496, -27450, -27405, -27359, -27313, - -27268, -27222, -27176, -27131, -27085, -27039, -26993, -26947, - -26902, -26856, -26810, -26764, -26718, -26672, -26626, -26580, - -26534, -26488, -26442, -26396, -26350, -26304, -26258, -26212, - -26166, -26120, -26074, -26028, -25982, -25936, -25889, -25843, - -25797, -25751, -25705, -25658, -25612, -25566, -25520, -25473, - -25427, -25381, -25334, -25288, -25241, -25195, -25149, -25102, - -25056, -25009, -24963, -24916, -24870, -24823, -24777, -24730, - -24684, -24637, -24591, -24544, -24497, -24451, -24404, -24357, - -24311, -24264, -24217, -24171, -24124, -24077, -24030, -23984, - -23937, -23890, -23843, -23796, -23750, -23703, -23656, -23609, - -23562, -23515, -23468, -23421, -23374, -23327, -23280, -23233, - -23186, -23139, -23092, -23045, -22998, -22951, -22904, -22857, - -22810, -22763, -22716, -22668, -22621, -22574, -22527, -22480, - -22432, -22385, -22338, -22291, -22243, -22196, -22149, -22102, - -22054, -22007, -21960, -21912, -21865, -21817, -21770, -21723, - -21675, -21628, -21580, -21533, -21485, -21438, -21390, -21343, - -21295, -21248, -21200, -21153, -21105, -21057, -21010, -20962, - -20915, -20867, -20819, -20772, -20724, -20676, -20629, -20581, - -20533, -20485, -20438, -20390, -20342, -20294, -20246, -20199, - -20151, -20103, -20055, -20007, -19959, -19912, -19864, -19816, - -19768, -19720, -19672, -19624, -19576, -19528, -19480, -19432, - -19384, -19336, -19288, -19240, -19192, -19144, -19096, -19048, - -19000, -18951, -18903, -18855, -18807, -18759, -18711, -18663, - -18614, -18566, -18518, -18470, -18421, -18373, -18325, -18277, - -18228, -18180, -18132, -18084, -18035, -17987, -17939, -17890, - -17842, -17793, -17745, -17697, -17648, -17600, -17551, -17503, - -17455, -17406, -17358, -17309, -17261, -17212, -17164, -17115, - -17067, -17018, -16970, -16921, -16872, -16824, -16775, -16727, - -16678, -16629, -16581, -16532, -16484, -16435, -16386, -16338, - -16289, -16240, -16191, -16143, -16094, -16045, -15997, -15948, - -15899, -15850, -15802, -15753, -15704, -15655, -15606, -15557, - -15509, -15460, -15411, -15362, -15313, -15264, -15215, -15167, - -15118, -15069, -15020, -14971, -14922, -14873, -14824, -14775, - -14726, -14677, -14628, -14579, -14530, -14481, -14432, -14383, - -14334, -14285, -14236, -14187, -14138, -14089, -14040, -13990, - -13941, -13892, -13843, -13794, -13745, -13696, -13647, -13597, - -13548, -13499, -13450, -13401, -13351, -13302, -13253, -13204, - -13154, -13105, -13056, -13007, -12957, -12908, -12859, -12810, - -12760, -12711, -12662, -12612, -12563, -12514, -12464, -12415, - -12366, -12316, -12267, -12217, -12168, -12119, -12069, -12020, - -11970, -11921, -11872, -11822, -11773, -11723, -11674, -11624, - -11575, -11525, -11476, -11426, -11377, -11327, -11278, -11228, - -11179, -11129, -11080, -11030, -10981, -10931, -10882, -10832, - -10782, -10733, -10683, -10634, -10584, -10534, -10485, -10435, - -10386, -10336, -10286, -10237, -10187, -10137, -10088, -10038, - -9988, -9939, -9889, -9839, -9790, -9740, -9690, -9640, - -9591, -9541, -9491, -9442, -9392, -9342, -9292, -9243, - -9193, -9143, -9093, -9043, -8994, -8944, -8894, -8844, - -8794, -8745, -8695, -8645, -8595, -8545, -8496, -8446, - -8396, -8346, -8296, -8246, -8196, -8147, -8097, -8047, - -7997, -7947, -7897, -7847, -7797, -7747, -7697, -7648, - -7598, -7548, -7498, -7448, -7398, -7348, -7298, -7248, - -7198, -7148, -7098, -7048, -6998, -6948, -6898, -6848, - -6798, -6748, -6698, -6648, -6598, -6548, -6498, -6448, - -6398, -6348, -6298, -6248, -6198, -6148, -6098, -6048, - -5998, -5948, -5898, -5848, -5798, -5747, -5697, -5647, - -5597, -5547, -5497, -5447, -5397, -5347, -5297, -5247, - -5197, -5146, -5096, -5046, -4996, -4946, -4896, -4846, - -4796, -4745, -4695, -4645, -4595, -4545, -4495, -4445, - -4394, -4344, -4294, -4244, -4194, -4144, -4093, -4043, - -3993, -3943, -3893, -3843, -3792, -3742, -3692, -3642, - -3592, -3541, -3491, -3441, -3391, -3341, -3291, -3240, - -3190, -3140, -3090, -3039, -2989, -2939, -2889, -2839, - -2788, -2738, -2688, -2638, -2588, -2537, -2487, -2437, - -2387, -2336, -2286, -2236, -2186, -2135, -2085, -2035, - -1985, -1934, -1884, -1834, -1784, -1733, -1683, -1633, - -1583, -1532, -1482, -1432, -1382, -1331, -1281, -1231, - -1181, -1130, -1080, -1030, -980, -929, -879, -829, - -779, -728, -678, -628, -578, -527, -477, -427, - -376, -326, -276, -226, -175, -125, -75, -25, - 25, 75, 125, 175, 226, 276, 326, 376, - 427, 477, 527, 578, 628, 678, 728, 779, - 829, 879, 929, 980, 1030, 1080, 1130, 1181, - 1231, 1281, 1331, 1382, 1432, 1482, 1532, 1583, - 1633, 1683, 1733, 1784, 1834, 1884, 1934, 1985, - 2035, 2085, 2135, 2186, 2236, 2286, 2336, 2387, - 2437, 2487, 2537, 2587, 2638, 2688, 2738, 2788, - 2839, 2889, 2939, 2989, 3039, 3090, 3140, 3190, - 3240, 3291, 3341, 3391, 3441, 3491, 3542, 3592, - 3642, 3692, 3742, 3792, 3843, 3893, 3943, 3993, - 4043, 4093, 4144, 4194, 4244, 4294, 4344, 4394, - 4445, 4495, 4545, 4595, 4645, 4695, 4745, 4796, - 4846, 4896, 4946, 4996, 5046, 5096, 5146, 5197, - 5247, 5297, 5347, 5397, 5447, 5497, 5547, 5597, - 5647, 5697, 5747, 5798, 5848, 5898, 5948, 5998, - 6048, 6098, 6148, 6198, 6248, 6298, 6348, 6398, - 6448, 6498, 6548, 6598, 6648, 6698, 6748, 6798, - 6848, 6898, 6948, 6998, 7048, 7098, 7148, 7198, - 7248, 7298, 7348, 7398, 7448, 7498, 7548, 7598, - 7648, 7697, 7747, 7797, 7847, 7897, 7947, 7997, - 8047, 8097, 8147, 8196, 8246, 8296, 8346, 8396, - 8446, 8496, 8545, 8595, 8645, 8695, 8745, 8794, - 8844, 8894, 8944, 8994, 9043, 9093, 9143, 9193, - 9243, 9292, 9342, 9392, 9442, 9491, 9541, 9591, - 9640, 9690, 9740, 9790, 9839, 9889, 9939, 9988, - 10038, 10088, 10137, 10187, 10237, 10286, 10336, 10386, - 10435, 10485, 10534, 10584, 10634, 10683, 10733, 10782, - 10832, 10882, 10931, 10981, 11030, 11080, 11129, 11179, - 11228, 11278, 11327, 11377, 11426, 11476, 11525, 11575, - 11624, 11674, 11723, 11773, 11822, 11872, 11921, 11970, - 12020, 12069, 12119, 12168, 12218, 12267, 12316, 12366, - 12415, 12464, 12514, 12563, 12612, 12662, 12711, 12760, - 12810, 12859, 12908, 12957, 13007, 13056, 13105, 13154, - 13204, 13253, 13302, 13351, 13401, 13450, 13499, 13548, - 13597, 13647, 13696, 13745, 13794, 13843, 13892, 13941, - 13990, 14040, 14089, 14138, 14187, 14236, 14285, 14334, - 14383, 14432, 14481, 14530, 14579, 14628, 14677, 14726, - 14775, 14824, 14873, 14922, 14971, 15020, 15069, 15118, - 15167, 15215, 15264, 15313, 15362, 15411, 15460, 15509, - 15557, 15606, 15655, 15704, 15753, 15802, 15850, 15899, - 15948, 15997, 16045, 16094, 16143, 16191, 16240, 16289, - 16338, 16386, 16435, 16484, 16532, 16581, 16629, 16678, - 16727, 16775, 16824, 16872, 16921, 16970, 17018, 17067, - 17115, 17164, 17212, 17261, 17309, 17358, 17406, 17455, - 17503, 17551, 17600, 17648, 17697, 17745, 17793, 17842, - 17890, 17939, 17987, 18035, 18084, 18132, 18180, 18228, - 18277, 18325, 18373, 18421, 18470, 18518, 18566, 18614, - 18663, 18711, 18759, 18807, 18855, 18903, 18951, 19000, - 19048, 19096, 19144, 19192, 19240, 19288, 19336, 19384, - 19432, 19480, 19528, 19576, 19624, 19672, 19720, 19768, - 19816, 19864, 19912, 19959, 20007, 20055, 20103, 20151, - 20199, 20246, 20294, 20342, 20390, 20438, 20485, 20533, - 20581, 20629, 20676, 20724, 20772, 20819, 20867, 20915, - 20962, 21010, 21057, 21105, 21153, 21200, 21248, 21295, - 21343, 21390, 21438, 21485, 21533, 21580, 21628, 21675, - 21723, 21770, 21817, 21865, 21912, 21960, 22007, 22054, - 22102, 22149, 22196, 22243, 22291, 22338, 22385, 22432, - 22480, 22527, 22574, 22621, 22668, 22716, 22763, 22810, - 22857, 22904, 22951, 22998, 23045, 23092, 23139, 23186, - 23233, 23280, 23327, 23374, 23421, 23468, 23515, 23562, - 23609, 23656, 23703, 23750, 23796, 23843, 23890, 23937, - 23984, 24030, 24077, 24124, 24171, 24217, 24264, 24311, - 24357, 24404, 24451, 24497, 24544, 24591, 24637, 24684, - 24730, 24777, 24823, 24870, 24916, 24963, 25009, 25056, - 25102, 25149, 25195, 25241, 25288, 25334, 25381, 25427, - 25473, 25520, 25566, 25612, 25658, 25705, 25751, 25797, - 25843, 25889, 25936, 25982, 26028, 26074, 26120, 26166, - 26212, 26258, 26304, 26350, 26396, 26442, 26488, 26534, - 26580, 26626, 26672, 26718, 26764, 26810, 26856, 26902, - 26947, 26993, 27039, 27085, 27131, 27176, 27222, 27268, - 27313, 27359, 27405, 27450, 27496, 27542, 27587, 27633, - 27678, 27724, 27770, 27815, 27861, 27906, 27952, 27997, - 28042, 28088, 28133, 28179, 28224, 28269, 28315, 28360, - 28405, 28451, 28496, 28541, 28586, 28632, 28677, 28722, - 28767, 28812, 28858, 28903, 28948, 28993, 29038, 29083, - 29128, 29173, 29218, 29263, 29308, 29353, 29398, 29443, - 29488, 29533, 29577, 29622, 29667, 29712, 29757, 29801, - 29846, 29891, 29936, 29980, 30025, 30070, 30114, 30159, - 30204, 30248, 30293, 30337, 30382, 30427, 30471, 30516, - 30560, 30604, 30649, 30693, 30738, 30782, 30826, 30871, - 30915, 30959, 31004, 31048, 31092, 31136, 31181, 31225, - 31269, 31313, 31357, 31402, 31446, 31490, 31534, 31578, - 31622, 31666, 31710, 31754, 31798, 31842, 31886, 31930, - 31974, 32017, 32061, 32105, 32149, 32193, 32236, 32280, - 32324, 32368, 32411, 32455, 32499, 32542, 32586, 32630, - 32673, 32717, 32760, 32804, 32847, 32891, 32934, 32978, - 33021, 33065, 33108, 33151, 33195, 33238, 33281, 33325, - 33368, 33411, 33454, 33498, 33541, 33584, 33627, 33670, - 33713, 33756, 33799, 33843, 33886, 33929, 33972, 34015, - 34057, 34100, 34143, 34186, 34229, 34272, 34315, 34358, - 34400, 34443, 34486, 34529, 34571, 34614, 34657, 34699, - 34742, 34785, 34827, 34870, 34912, 34955, 34997, 35040, - 35082, 35125, 35167, 35210, 35252, 35294, 35337, 35379, - 35421, 35464, 35506, 35548, 35590, 35633, 35675, 35717, - 35759, 35801, 35843, 35885, 35927, 35969, 36011, 36053, - 36095, 36137, 36179, 36221, 36263, 36305, 36347, 36388, - 36430, 36472, 36514, 36556, 36597, 36639, 36681, 36722, - 36764, 36805, 36847, 36889, 36930, 36972, 37013, 37055, - 37096, 37137, 37179, 37220, 37262, 37303, 37344, 37386, - 37427, 37468, 37509, 37551, 37592, 37633, 37674, 37715, - 37756, 37797, 37838, 37879, 37920, 37961, 38002, 38043, - 38084, 38125, 38166, 38207, 38248, 38288, 38329, 38370, - 38411, 38451, 38492, 38533, 38573, 38614, 38655, 38695, - 38736, 38776, 38817, 38857, 38898, 38938, 38979, 39019, - 39059, 39100, 39140, 39180, 39221, 39261, 39301, 39341, - 39382, 39422, 39462, 39502, 39542, 39582, 39622, 39662, - 39702, 39742, 39782, 39822, 39862, 39902, 39942, 39982, - 40021, 40061, 40101, 40141, 40180, 40220, 40260, 40299, - 40339, 40379, 40418, 40458, 40497, 40537, 40576, 40616, - 40655, 40695, 40734, 40773, 40813, 40852, 40891, 40931, - 40970, 41009, 41048, 41087, 41127, 41166, 41205, 41244, - 41283, 41322, 41361, 41400, 41439, 41478, 41517, 41556, - 41595, 41633, 41672, 41711, 41750, 41788, 41827, 41866, - 41904, 41943, 41982, 42020, 42059, 42097, 42136, 42174, - 42213, 42251, 42290, 42328, 42366, 42405, 42443, 42481, - 42520, 42558, 42596, 42634, 42672, 42711, 42749, 42787, - 42825, 42863, 42901, 42939, 42977, 43015, 43053, 43091, - 43128, 43166, 43204, 43242, 43280, 43317, 43355, 43393, - 43430, 43468, 43506, 43543, 43581, 43618, 43656, 43693, - 43731, 43768, 43806, 43843, 43880, 43918, 43955, 43992, - 44029, 44067, 44104, 44141, 44178, 44215, 44252, 44289, - 44326, 44363, 44400, 44437, 44474, 44511, 44548, 44585, - 44622, 44659, 44695, 44732, 44769, 44806, 44842, 44879, - 44915, 44952, 44989, 45025, 45062, 45098, 45135, 45171, - 45207, 45244, 45280, 45316, 45353, 45389, 45425, 45462, - 45498, 45534, 45570, 45606, 45642, 45678, 45714, 45750, - 45786, 45822, 45858, 45894, 45930, 45966, 46002, 46037, - 46073, 46109, 46145, 46180, 46216, 46252, 46287, 46323, - 46358, 46394, 46429, 46465, 46500, 46536, 46571, 46606, - 46642, 46677, 46712, 46747, 46783, 46818, 46853, 46888, - 46923, 46958, 46993, 47028, 47063, 47098, 47133, 47168, - 47203, 47238, 47273, 47308, 47342, 47377, 47412, 47446, - 47481, 47516, 47550, 47585, 47619, 47654, 47688, 47723, - 47757, 47792, 47826, 47861, 47895, 47929, 47963, 47998, - 48032, 48066, 48100, 48134, 48168, 48202, 48237, 48271, - 48305, 48338, 48372, 48406, 48440, 48474, 48508, 48542, - 48575, 48609, 48643, 48676, 48710, 48744, 48777, 48811, - 48844, 48878, 48911, 48945, 48978, 49012, 49045, 49078, - 49112, 49145, 49178, 49211, 49244, 49278, 49311, 49344, - 49377, 49410, 49443, 49476, 49509, 49542, 49575, 49608, - 49640, 49673, 49706, 49739, 49771, 49804, 49837, 49869, - 49902, 49935, 49967, 50000, 50032, 50064, 50097, 50129, - 50162, 50194, 50226, 50259, 50291, 50323, 50355, 50387, - 50420, 50452, 50484, 50516, 50548, 50580, 50612, 50644, - 50675, 50707, 50739, 50771, 50803, 50834, 50866, 50898, - 50929, 50961, 50993, 51024, 51056, 51087, 51119, 51150, - 51182, 51213, 51244, 51276, 51307, 51338, 51369, 51401, - 51432, 51463, 51494, 51525, 51556, 51587, 51618, 51649, - 51680, 51711, 51742, 51773, 51803, 51834, 51865, 51896, - 51926, 51957, 51988, 52018, 52049, 52079, 52110, 52140, - 52171, 52201, 52231, 52262, 52292, 52322, 52353, 52383, - 52413, 52443, 52473, 52503, 52534, 52564, 52594, 52624, - 52653, 52683, 52713, 52743, 52773, 52803, 52832, 52862, - 52892, 52922, 52951, 52981, 53010, 53040, 53069, 53099, - 53128, 53158, 53187, 53216, 53246, 53275, 53304, 53334, - 53363, 53392, 53421, 53450, 53479, 53508, 53537, 53566, - 53595, 53624, 53653, 53682, 53711, 53739, 53768, 53797, - 53826, 53854, 53883, 53912, 53940, 53969, 53997, 54026, - 54054, 54082, 54111, 54139, 54167, 54196, 54224, 54252, - 54280, 54309, 54337, 54365, 54393, 54421, 54449, 54477, - 54505, 54533, 54560, 54588, 54616, 54644, 54672, 54699, - 54727, 54755, 54782, 54810, 54837, 54865, 54892, 54920, - 54947, 54974, 55002, 55029, 55056, 55084, 55111, 55138, - 55165, 55192, 55219, 55246, 55274, 55300, 55327, 55354, - 55381, 55408, 55435, 55462, 55489, 55515, 55542, 55569, - 55595, 55622, 55648, 55675, 55701, 55728, 55754, 55781, - 55807, 55833, 55860, 55886, 55912, 55938, 55965, 55991, - 56017, 56043, 56069, 56095, 56121, 56147, 56173, 56199, - 56225, 56250, 56276, 56302, 56328, 56353, 56379, 56404, - 56430, 56456, 56481, 56507, 56532, 56557, 56583, 56608, - 56633, 56659, 56684, 56709, 56734, 56760, 56785, 56810, - 56835, 56860, 56885, 56910, 56935, 56959, 56984, 57009, - 57034, 57059, 57083, 57108, 57133, 57157, 57182, 57206, - 57231, 57255, 57280, 57304, 57329, 57353, 57377, 57402, - 57426, 57450, 57474, 57498, 57522, 57546, 57570, 57594, - 57618, 57642, 57666, 57690, 57714, 57738, 57762, 57785, - 57809, 57833, 57856, 57880, 57903, 57927, 57950, 57974, - 57997, 58021, 58044, 58067, 58091, 58114, 58137, 58160, - 58183, 58207, 58230, 58253, 58276, 58299, 58322, 58345, - 58367, 58390, 58413, 58436, 58459, 58481, 58504, 58527, - 58549, 58572, 58594, 58617, 58639, 58662, 58684, 58706, - 58729, 58751, 58773, 58795, 58818, 58840, 58862, 58884, - 58906, 58928, 58950, 58972, 58994, 59016, 59038, 59059, - 59081, 59103, 59125, 59146, 59168, 59190, 59211, 59233, - 59254, 59276, 59297, 59318, 59340, 59361, 59382, 59404, - 59425, 59446, 59467, 59488, 59509, 59530, 59551, 59572, - 59593, 59614, 59635, 59656, 59677, 59697, 59718, 59739, - 59759, 59780, 59801, 59821, 59842, 59862, 59883, 59903, - 59923, 59944, 59964, 59984, 60004, 60025, 60045, 60065, - 60085, 60105, 60125, 60145, 60165, 60185, 60205, 60225, - 60244, 60264, 60284, 60304, 60323, 60343, 60363, 60382, - 60402, 60421, 60441, 60460, 60479, 60499, 60518, 60537, - 60556, 60576, 60595, 60614, 60633, 60652, 60671, 60690, - 60709, 60728, 60747, 60766, 60785, 60803, 60822, 60841, - 60859, 60878, 60897, 60915, 60934, 60952, 60971, 60989, - 61007, 61026, 61044, 61062, 61081, 61099, 61117, 61135, - 61153, 61171, 61189, 61207, 61225, 61243, 61261, 61279, - 61297, 61314, 61332, 61350, 61367, 61385, 61403, 61420, - 61438, 61455, 61473, 61490, 61507, 61525, 61542, 61559, - 61577, 61594, 61611, 61628, 61645, 61662, 61679, 61696, - 61713, 61730, 61747, 61764, 61780, 61797, 61814, 61831, - 61847, 61864, 61880, 61897, 61913, 61930, 61946, 61963, - 61979, 61995, 62012, 62028, 62044, 62060, 62076, 62092, - 62108, 62125, 62141, 62156, 62172, 62188, 62204, 62220, - 62236, 62251, 62267, 62283, 62298, 62314, 62329, 62345, - 62360, 62376, 62391, 62407, 62422, 62437, 62453, 62468, - 62483, 62498, 62513, 62528, 62543, 62558, 62573, 62588, - 62603, 62618, 62633, 62648, 62662, 62677, 62692, 62706, - 62721, 62735, 62750, 62764, 62779, 62793, 62808, 62822, - 62836, 62850, 62865, 62879, 62893, 62907, 62921, 62935, - 62949, 62963, 62977, 62991, 63005, 63019, 63032, 63046, - 63060, 63074, 63087, 63101, 63114, 63128, 63141, 63155, - 63168, 63182, 63195, 63208, 63221, 63235, 63248, 63261, - 63274, 63287, 63300, 63313, 63326, 63339, 63352, 63365, - 63378, 63390, 63403, 63416, 63429, 63441, 63454, 63466, - 63479, 63491, 63504, 63516, 63528, 63541, 63553, 63565, - 63578, 63590, 63602, 63614, 63626, 63638, 63650, 63662, - 63674, 63686, 63698, 63709, 63721, 63733, 63745, 63756, - 63768, 63779, 63791, 63803, 63814, 63825, 63837, 63848, - 63859, 63871, 63882, 63893, 63904, 63915, 63927, 63938, - 63949, 63960, 63971, 63981, 63992, 64003, 64014, 64025, - 64035, 64046, 64057, 64067, 64078, 64088, 64099, 64109, - 64120, 64130, 64140, 64151, 64161, 64171, 64181, 64192, - 64202, 64212, 64222, 64232, 64242, 64252, 64261, 64271, - 64281, 64291, 64301, 64310, 64320, 64330, 64339, 64349, - 64358, 64368, 64377, 64387, 64396, 64405, 64414, 64424, - 64433, 64442, 64451, 64460, 64469, 64478, 64487, 64496, - 64505, 64514, 64523, 64532, 64540, 64549, 64558, 64566, - 64575, 64584, 64592, 64600, 64609, 64617, 64626, 64634, - 64642, 64651, 64659, 64667, 64675, 64683, 64691, 64699, - 64707, 64715, 64723, 64731, 64739, 64747, 64754, 64762, - 64770, 64777, 64785, 64793, 64800, 64808, 64815, 64822, - 64830, 64837, 64844, 64852, 64859, 64866, 64873, 64880, - 64887, 64895, 64902, 64908, 64915, 64922, 64929, 64936, - 64943, 64949, 64956, 64963, 64969, 64976, 64982, 64989, - 64995, 65002, 65008, 65015, 65021, 65027, 65033, 65040, - 65046, 65052, 65058, 65064, 65070, 65076, 65082, 65088, - 65094, 65099, 65105, 65111, 65117, 65122, 65128, 65133, - 65139, 65144, 65150, 65155, 65161, 65166, 65171, 65177, - 65182, 65187, 65192, 65197, 65202, 65207, 65212, 65217, - 65222, 65227, 65232, 65237, 65242, 65246, 65251, 65256, - 65260, 65265, 65270, 65274, 65279, 65283, 65287, 65292, - 65296, 65300, 65305, 65309, 65313, 65317, 65321, 65325, - 65329, 65333, 65337, 65341, 65345, 65349, 65352, 65356, - 65360, 65363, 65367, 65371, 65374, 65378, 65381, 65385, - 65388, 65391, 65395, 65398, 65401, 65404, 65408, 65411, - 65414, 65417, 65420, 65423, 65426, 65429, 65431, 65434, - 65437, 65440, 65442, 65445, 65448, 65450, 65453, 65455, - 65458, 65460, 65463, 65465, 65467, 65470, 65472, 65474, - 65476, 65478, 65480, 65482, 65484, 65486, 65488, 65490, - 65492, 65494, 65496, 65497, 65499, 65501, 65502, 65504, - 65505, 65507, 65508, 65510, 65511, 65513, 65514, 65515, - 65516, 65518, 65519, 65520, 65521, 65522, 65523, 65524, - 65525, 65526, 65527, 65527, 65528, 65529, 65530, 65530, + -65536, -65535, -65535, -65535, -65535, -65535, -65535, -65535, + -65534, -65534, -65534, -65533, -65533, -65532, -65532, -65531, + -65531, -65530, -65529, -65529, -65528, -65527, -65526, -65525, + -65524, -65523, -65522, -65521, -65520, -65519, -65518, -65517, + -65516, -65515, -65513, -65512, -65511, -65509, -65508, -65506, + -65505, -65503, -65501, -65500, -65498, -65496, -65495, -65493, + -65491, -65489, -65487, -65485, -65483, -65481, -65479, -65477, + -65475, -65473, -65471, -65468, -65466, -65464, -65461, -65459, + -65457, -65454, -65452, -65449, -65446, -65444, -65441, -65438, + -65436, -65433, -65430, -65427, -65424, -65421, -65418, -65415, + -65412, -65409, -65406, -65403, -65400, -65396, -65393, -65390, + -65386, -65383, -65379, -65376, -65372, -65369, -65365, -65362, + -65358, -65354, -65350, -65347, -65343, -65339, -65335, -65331, + -65327, -65323, -65319, -65315, -65311, -65307, -65302, -65298, + -65294, -65290, -65285, -65281, -65276, -65272, -65267, -65263, + -65258, -65253, -65249, -65244, -65239, -65235, -65230, -65225, + -65220, -65215, -65210, -65205, -65200, -65195, -65190, -65184, + -65179, -65174, -65169, -65163, -65158, -65153, -65147, -65142, + -65136, -65131, -65125, -65119, -65114, -65108, -65102, -65096, + -65091, -65085, -65079, -65073, -65067, -65061, -65055, -65049, + -65043, -65036, -65030, -65024, -65018, -65011, -65005, -64999, + -64992, -64986, -64979, -64973, -64966, -64959, -64953, -64946, + -64939, -64933, -64926, -64919, -64912, -64905, -64898, -64891, + -64884, -64877, -64870, -64863, -64855, -64848, -64841, -64834, + -64826, -64819, -64811, -64804, -64796, -64789, -64781, -64774, + -64766, -64758, -64751, -64743, -64735, -64727, -64719, -64711, + -64703, -64695, -64687, -64679, -64671, -64663, -64655, -64646, + -64638, -64630, -64622, -64613, -64605, -64596, -64588, -64579, + -64571, -64562, -64553, -64545, -64536, -64527, -64518, -64510, + -64501, -64492, -64483, -64474, -64465, -64456, -64447, -64437, + -64428, -64419, -64410, -64401, -64391, -64382, -64372, -64363, + -64353, -64344, -64334, -64325, -64315, -64305, -64296, -64286, + -64276, -64266, -64257, -64247, -64237, -64227, -64217, -64207, + -64197, -64186, -64176, -64166, -64156, -64146, -64135, -64125, + -64115, -64104, -64094, -64083, -64073, -64062, -64051, -64041, + -64030, -64019, -64009, -63998, -63987, -63976, -63965, -63954, + -63943, -63932, -63921, -63910, -63899, -63888, -63876, -63865, + -63854, -63842, -63831, -63820, -63808, -63797, -63785, -63774, + -63762, -63750, -63739, -63727, -63715, -63704, -63692, -63680, + -63668, -63656, -63644, -63632, -63620, -63608, -63596, -63584, + -63571, -63559, -63547, -63535, -63522, -63510, -63498, -63485, + -63473, -63460, -63447, -63435, -63422, -63410, -63397, -63384, + -63371, -63358, -63346, -63333, -63320, -63307, -63294, -63281, + -63268, -63254, -63241, -63228, -63215, -63202, -63188, -63175, + -63162, -63148, -63135, -63121, -63108, -63094, -63080, -63067, + -63053, -63039, -63026, -63012, -62998, -62984, -62970, -62956, + -62942, -62928, -62914, -62900, -62886, -62872, -62858, -62843, + -62829, -62815, -62800, -62786, -62772, -62757, -62743, -62728, + -62714, -62699, -62684, -62670, -62655, -62640, -62625, -62610, + -62596, -62581, -62566, -62551, -62536, -62521, -62506, -62491, + -62475, -62460, -62445, -62430, -62414, -62399, -62384, -62368, + -62353, -62337, -62322, -62306, -62291, -62275, -62259, -62244, + -62228, -62212, -62196, -62180, -62164, -62148, -62133, -62117, + -62100, -62084, -62068, -62052, -62036, -62020, -62003, -61987, + -61971, -61954, -61938, -61922, -61905, -61889, -61872, -61855, + -61839, -61822, -61805, -61789, -61772, -61755, -61738, -61721, + -61705, -61688, -61671, -61654, -61637, -61619, -61602, -61585, + -61568, -61551, -61533, -61516, -61499, -61481, -61464, -61446, + -61429, -61411, -61394, -61376, -61359, -61341, -61323, -61305, + -61288, -61270, -61252, -61234, -61216, -61198, -61180, -61162, + -61144, -61126, -61108, -61090, -61071, -61053, -61035, -61017, + -60998, -60980, -60961, -60943, -60924, -60906, -60887, -60869, + -60850, -60831, -60813, -60794, -60775, -60756, -60737, -60719, + -60700, -60681, -60662, -60643, -60624, -60604, -60585, -60566, + -60547, -60528, -60508, -60489, -60470, -60450, -60431, -60411, + -60392, -60372, -60353, -60333, -60313, -60294, -60274, -60254, + -60235, -60215, -60195, -60175, -60155, -60135, -60115, -60095, + -60075, -60055, -60035, -60015, -59994, -59974, -59954, -59934, + -59913, -59893, -59872, -59852, -59831, -59811, -59790, -59770, + -59749, -59728, -59708, -59687, -59666, -59645, -59625, -59604, + -59583, -59562, -59541, -59520, -59499, -59478, -59457, -59435, + -59414, -59393, -59372, -59350, -59329, -59308, -59286, -59265, + -59243, -59222, -59200, -59179, -59157, -59135, -59114, -59092, + -59070, -59049, -59027, -59005, -58983, -58961, -58939, -58917, + -58895, -58873, -58851, -58829, -58807, -58784, -58762, -58740, + -58718, -58695, -58673, -58650, -58628, -58605, -58583, -58560, + -58538, -58515, -58493, -58470, -58447, -58424, -58402, -58379, + -58356, -58333, -58310, -58287, -58264, -58241, -58218, -58195, + -58172, -58149, -58125, -58102, -58079, -58056, -58032, -58009, + -57986, -57962, -57939, -57915, -57892, -57868, -57844, -57821, + -57797, -57773, -57750, -57726, -57702, -57678, -57654, -57630, + -57606, -57582, -57558, -57534, -57510, -57486, -57462, -57438, + -57414, -57389, -57365, -57341, -57316, -57292, -57268, -57243, + -57219, -57194, -57170, -57145, -57120, -57096, -57071, -57046, + -57022, -56997, -56972, -56947, -56922, -56897, -56872, -56847, + -56822, -56797, -56772, -56747, -56722, -56697, -56671, -56646, + -56621, -56595, -56570, -56545, -56519, -56494, -56468, -56443, + -56417, -56392, -56366, -56340, -56315, -56289, -56263, -56237, + -56212, -56186, -56160, -56134, -56108, -56082, -56056, -56030, + -56004, -55978, -55952, -55925, -55899, -55873, -55847, -55820, + -55794, -55768, -55741, -55715, -55688, -55662, -55635, -55609, + -55582, -55555, -55529, -55502, -55475, -55448, -55422, -55395, + -55368, -55341, -55314, -55287, -55260, -55233, -55206, -55179, + -55152, -55124, -55097, -55070, -55043, -55015, -54988, -54961, + -54933, -54906, -54879, -54851, -54823, -54796, -54768, -54741, + -54713, -54685, -54658, -54630, -54602, -54574, -54546, -54519, + -54491, -54463, -54435, -54407, -54379, -54351, -54323, -54294, + -54266, -54238, -54210, -54182, -54153, -54125, -54097, -54068, + -54040, -54011, -53983, -53954, -53926, -53897, -53869, -53840, + -53811, -53783, -53754, -53725, -53696, -53667, -53639, -53610, + -53581, -53552, -53523, -53494, -53465, -53436, -53407, -53377, + -53348, -53319, -53290, -53260, -53231, -53202, -53172, -53143, + -53114, -53084, -53055, -53025, -52996, -52966, -52936, -52907, + -52877, -52847, -52818, -52788, -52758, -52728, -52698, -52668, + -52639, -52609, -52579, -52549, -52518, -52488, -52458, -52428, + -52398, -52368, -52338, -52307, -52277, -52247, -52216, -52186, + -52155, -52125, -52095, -52064, -52033, -52003, -51972, -51942, + -51911, -51880, -51850, -51819, -51788, -51757, -51726, -51695, + -51665, -51634, -51603, -51572, -51541, -51510, -51478, -51447, + -51416, -51385, -51354, -51323, -51291, -51260, -51229, -51197, + -51166, -51134, -51103, -51072, -51040, -51008, -50977, -50945, + -50914, -50882, -50850, -50819, -50787, -50755, -50723, -50691, + -50660, -50628, -50596, -50564, -50532, -50500, -50468, -50436, + -50403, -50371, -50339, -50307, -50275, -50242, -50210, -50178, + -50146, -50113, -50081, -50048, -50016, -49983, -49951, -49918, + -49886, -49853, -49820, -49788, -49755, -49722, -49690, -49657, + -49624, -49591, -49558, -49525, -49492, -49459, -49426, -49393, + -49360, -49327, -49294, -49261, -49228, -49195, -49161, -49128, + -49095, -49062, -49028, -48995, -48961, -48928, -48895, -48861, + -48828, -48794, -48760, -48727, -48693, -48660, -48626, -48592, + -48558, -48525, -48491, -48457, -48423, -48389, -48355, -48321, + -48288, -48254, -48219, -48185, -48151, -48117, -48083, -48049, + -48015, -47981, -47946, -47912, -47878, -47843, -47809, -47775, + -47740, -47706, -47671, -47637, -47602, -47568, -47533, -47498, + -47464, -47429, -47394, -47360, -47325, -47290, -47255, -47220, + -47186, -47151, -47116, -47081, -47046, -47011, -46976, -46941, + -46906, -46871, -46835, -46800, -46765, -46730, -46695, -46659, + -46624, -46589, -46553, -46518, -46482, -46447, -46411, -46376, + -46340, -46305, -46269, -46234, -46198, -46162, -46127, -46091, + -46055, -46019, -45984, -45948, -45912, -45876, -45840, -45804, + -45768, -45732, -45696, -45660, -45624, -45588, -45552, -45516, + -45480, -45443, -45407, -45371, -45335, -45298, -45262, -45226, + -45189, -45153, -45116, -45080, -45043, -45007, -44970, -44934, + -44897, -44861, -44824, -44787, -44750, -44714, -44677, -44640, + -44603, -44567, -44530, -44493, -44456, -44419, -44382, -44345, + -44308, -44271, -44234, -44197, -44160, -44122, -44085, -44048, + -44011, -43974, -43936, -43899, -43862, -43824, -43787, -43749, + -43712, -43675, -43637, -43600, -43562, -43524, -43487, -43449, + -43412, -43374, -43336, -43298, -43261, -43223, -43185, -43147, + -43110, -43072, -43034, -42996, -42958, -42920, -42882, -42844, + -42806, -42768, -42730, -42692, -42653, -42615, -42577, -42539, + -42501, -42462, -42424, -42386, -42347, -42309, -42271, -42232, + -42194, -42155, -42117, -42078, -42040, -42001, -41962, -41924, + -41885, -41846, -41808, -41769, -41730, -41692, -41653, -41614, + -41575, -41536, -41497, -41458, -41419, -41381, -41342, -41303, + -41263, -41224, -41185, -41146, -41107, -41068, -41029, -40990, + -40950, -40911, -40872, -40832, -40793, -40754, -40714, -40675, + -40636, -40596, -40557, -40517, -40478, -40438, -40399, -40359, + -40319, -40280, -40240, -40200, -40161, -40121, -40081, -40041, + -40002, -39962, -39922, -39882, -39842, -39802, -39762, -39722, + -39682, -39642, -39602, -39562, -39522, -39482, -39442, -39402, + -39362, -39321, -39281, -39241, -39201, -39160, -39120, -39080, + -39039, -38999, -38958, -38918, -38878, -38837, -38797, -38756, + -38716, -38675, -38634, -38594, -38553, -38512, -38472, -38431, + -38390, -38350, -38309, -38268, -38227, -38186, -38146, -38105, + -38064, -38023, -37982, -37941, -37900, -37859, -37818, -37777, + -37736, -37695, -37653, -37612, -37571, -37530, -37489, -37447, + -37406, -37365, -37324, -37282, -37241, -37200, -37158, -37117, + -37075, -37034, -36992, -36951, -36909, -36868, -36826, -36785, + -36743, -36701, -36660, -36618, -36576, -36535, -36493, -36451, + -36409, -36368, -36326, -36284, -36242, -36200, -36158, -36116, + -36074, -36032, -35990, -35948, -35906, -35864, -35822, -35780, + -35738, -35696, -35654, -35611, -35569, -35527, -35485, -35442, + -35400, -35358, -35316, -35273, -35231, -35188, -35146, -35104, + -35061, -35019, -34976, -34934, -34891, -34849, -34806, -34763, + -34721, -34678, -34635, -34593, -34550, -34507, -34465, -34422, + -34379, -34336, -34293, -34251, -34208, -34165, -34122, -34079, + -34036, -33993, -33950, -33907, -33864, -33821, -33778, -33735, + -33692, -33649, -33605, -33562, -33519, -33476, -33433, -33389, + -33346, -33303, -33260, -33216, -33173, -33130, -33086, -33043, + -32999, -32956, -32912, -32869, -32826, -32782, -32738, -32695, + -32651, -32608, -32564, -32521, -32477, -32433, -32390, -32346, + -32302, -32258, -32215, -32171, -32127, -32083, -32039, -31995, + -31952, -31908, -31864, -31820, -31776, -31732, -31688, -31644, + -31600, -31556, -31512, -31468, -31424, -31379, -31335, -31291, + -31247, -31203, -31159, -31114, -31070, -31026, -30982, -30937, + -30893, -30849, -30804, -30760, -30715, -30671, -30627, -30582, + -30538, -30493, -30449, -30404, -30360, -30315, -30271, -30226, + -30181, -30137, -30092, -30047, -30003, -29958, -29913, -29869, + -29824, -29779, -29734, -29690, -29645, -29600, -29555, -29510, + -29465, -29420, -29375, -29330, -29285, -29241, -29196, -29151, + -29105, -29060, -29015, -28970, -28925, -28880, -28835, -28790, + -28745, -28699, -28654, -28609, -28564, -28519, -28473, -28428, + -28383, -28337, -28292, -28247, -28201, -28156, -28111, -28065, + -28020, -27974, -27929, -27883, -27838, -27792, -27747, -27701, + -27656, -27610, -27565, -27519, -27473, -27428, -27382, -27336, + -27291, -27245, -27199, -27153, -27108, -27062, -27016, -26970, + -26925, -26879, -26833, -26787, -26741, -26695, -26649, -26603, + -26557, -26511, -26465, -26419, -26373, -26327, -26281, -26235, + -26189, -26143, -26097, -26051, -26005, -25959, -25913, -25866, + -25820, -25774, -25728, -25681, -25635, -25589, -25543, -25496, + -25450, -25404, -25357, -25311, -25265, -25218, -25172, -25125, + -25079, -25033, -24986, -24940, -24893, -24847, -24800, -24754, + -24707, -24660, -24614, -24567, -24521, -24474, -24427, -24381, + -24334, -24287, -24241, -24194, -24147, -24101, -24054, -24007, + -23960, -23914, -23867, -23820, -23773, -23726, -23679, -23632, + -23586, -23539, -23492, -23445, -23398, -23351, -23304, -23257, + -23210, -23163, -23116, -23069, -23022, -22975, -22928, -22881, + -22833, -22786, -22739, -22692, -22645, -22598, -22551, -22503, + -22456, -22409, -22362, -22314, -22267, -22220, -22173, -22125, + -22078, -22031, -21983, -21936, -21889, -21841, -21794, -21746, + -21699, -21651, -21604, -21557, -21509, -21462, -21414, -21367, + -21319, -21271, -21224, -21176, -21129, -21081, -21034, -20986, + -20938, -20891, -20843, -20795, -20748, -20700, -20652, -20605, + -20557, -20509, -20461, -20414, -20366, -20318, -20270, -20223, + -20175, -20127, -20079, -20031, -19983, -19935, -19888, -19840, + -19792, -19744, -19696, -19648, -19600, -19552, -19504, -19456, + -19408, -19360, -19312, -19264, -19216, -19168, -19120, -19072, + -19024, -18975, -18927, -18879, -18831, -18783, -18735, -18687, + -18638, -18590, -18542, -18494, -18446, -18397, -18349, -18301, + -18253, -18204, -18156, -18108, -18059, -18011, -17963, -17914, + -17866, -17818, -17769, -17721, -17672, -17624, -17576, -17527, + -17479, -17430, -17382, -17333, -17285, -17236, -17188, -17139, + -17091, -17042, -16994, -16945, -16897, -16848, -16800, -16751, + -16702, -16654, -16605, -16557, -16508, -16459, -16411, -16362, + -16313, -16265, -16216, -16167, -16118, -16070, -16021, -15972, + -15923, -15875, -15826, -15777, -15728, -15680, -15631, -15582, + -15533, -15484, -15435, -15387, -15338, -15289, -15240, -15191, + -15142, -15093, -15044, -14995, -14946, -14897, -14849, -14800, + -14751, -14702, -14653, -14604, -14555, -14506, -14457, -14408, + -14359, -14309, -14260, -14211, -14162, -14113, -14064, -14015, + -13966, -13917, -13868, -13819, -13769, -13720, -13671, -13622, + -13573, -13524, -13474, -13425, -13376, -13327, -13278, -13228, + -13179, -13130, -13081, -13031, -12982, -12933, -12884, -12834, + -12785, -12736, -12686, -12637, -12588, -12538, -12489, -12440, + -12390, -12341, -12292, -12242, -12193, -12143, -12094, -12045, + -11995, -11946, -11896, -11847, -11797, -11748, -11699, -11649, + -11600, -11550, -11501, -11451, -11402, -11352, -11303, -11253, + -11204, -11154, -11105, -11055, -11006, -10956, -10906, -10857, + -10807, -10758, -10708, -10658, -10609, -10559, -10510, -10460, + -10410, -10361, -10311, -10262, -10212, -10162, -10113, -10063, + -10013, -9964, -9914, -9864, -9814, -9765, -9715, -9665, + -9616, -9566, -9516, -9466, -9417, -9367, -9317, -9267, + -9218, -9168, -9118, -9068, -9019, -8969, -8919, -8869, + -8819, -8770, -8720, -8670, -8620, -8570, -8520, -8471, + -8421, -8371, -8321, -8271, -8221, -8171, -8122, -8072, + -8022, -7972, -7922, -7872, -7822, -7772, -7722, -7672, + -7623, -7573, -7523, -7473, -7423, -7373, -7323, -7273, + -7223, -7173, -7123, -7073, -7023, -6973, -6923, -6873, + -6823, -6773, -6723, -6673, -6623, -6573, -6523, -6473, + -6423, -6373, -6323, -6273, -6223, -6173, -6123, -6073, + -6023, -5973, -5923, -5873, -5823, -5773, -5722, -5672, + -5622, -5572, -5522, -5472, -5422, -5372, -5322, -5272, + -5222, -5171, -5121, -5071, -5021, -4971, -4921, -4871, + -4821, -4770, -4720, -4670, -4620, -4570, -4520, -4470, + -4420, -4369, -4319, -4269, -4219, -4169, -4119, -4068, + -4018, -3968, -3918, -3868, -3818, -3767, -3717, -3667, + -3617, -3567, -3516, -3466, -3416, -3366, -3316, -3265, + -3215, -3165, -3115, -3065, -3014, -2964, -2914, -2864, + -2814, -2763, -2713, -2663, -2613, -2562, -2512, -2462, + -2412, -2361, -2311, -2261, -2211, -2161, -2110, -2060, + -2010, -1960, -1909, -1859, -1809, -1759, -1708, -1658, + -1608, -1558, -1507, -1457, -1407, -1357, -1306, -1256, + -1206, -1156, -1105, -1055, -1005, -955, -904, -854, + -804, -753, -703, -653, -603, -552, -502, -452, + -402, -351, -301, -251, -201, -150, -100, -50, + 0, 50, 100, 150, 201, 251, 301, 351, + 402, 452, 502, 552, 603, 653, 703, 753, + 804, 854, 904, 955, 1005, 1055, 1105, 1156, + 1206, 1256, 1306, 1357, 1407, 1457, 1507, 1558, + 1608, 1658, 1708, 1759, 1809, 1859, 1909, 1960, + 2010, 2060, 2110, 2161, 2211, 2261, 2311, 2361, + 2412, 2462, 2512, 2562, 2613, 2663, 2713, 2763, + 2814, 2864, 2914, 2964, 3014, 3065, 3115, 3165, + 3215, 3265, 3316, 3366, 3416, 3466, 3516, 3567, + 3617, 3667, 3717, 3767, 3818, 3868, 3918, 3968, + 4018, 4068, 4119, 4169, 4219, 4269, 4319, 4369, + 4420, 4470, 4520, 4570, 4620, 4670, 4720, 4770, + 4821, 4871, 4921, 4971, 5021, 5071, 5121, 5171, + 5222, 5272, 5322, 5372, 5422, 5472, 5522, 5572, + 5622, 5672, 5722, 5773, 5823, 5873, 5923, 5973, + 6023, 6073, 6123, 6173, 6223, 6273, 6323, 6373, + 6423, 6473, 6523, 6573, 6623, 6673, 6723, 6773, + 6823, 6873, 6923, 6973, 7023, 7073, 7123, 7173, + 7223, 7273, 7323, 7373, 7423, 7473, 7523, 7573, + 7623, 7672, 7722, 7772, 7822, 7872, 7922, 7972, + 8022, 8072, 8122, 8171, 8221, 8271, 8321, 8371, + 8421, 8471, 8520, 8570, 8620, 8670, 8720, 8770, + 8819, 8869, 8919, 8969, 9019, 9068, 9118, 9168, + 9218, 9267, 9317, 9367, 9417, 9466, 9516, 9566, + 9616, 9665, 9715, 9765, 9814, 9864, 9914, 9964, + 10013, 10063, 10113, 10162, 10212, 10262, 10311, 10361, + 10410, 10460, 10510, 10559, 10609, 10658, 10708, 10758, + 10807, 10857, 10906, 10956, 11006, 11055, 11105, 11154, + 11204, 11253, 11303, 11352, 11402, 11451, 11501, 11550, + 11600, 11649, 11699, 11748, 11797, 11847, 11896, 11946, + 11995, 12045, 12094, 12143, 12193, 12242, 12292, 12341, + 12390, 12440, 12489, 12538, 12588, 12637, 12686, 12736, + 12785, 12834, 12884, 12933, 12982, 13031, 13081, 13130, + 13179, 13228, 13278, 13327, 13376, 13425, 13474, 13524, + 13573, 13622, 13671, 13720, 13769, 13819, 13868, 13917, + 13966, 14015, 14064, 14113, 14162, 14211, 14260, 14309, + 14359, 14408, 14457, 14506, 14555, 14604, 14653, 14702, + 14751, 14800, 14849, 14897, 14946, 14995, 15044, 15093, + 15142, 15191, 15240, 15289, 15338, 15387, 15435, 15484, + 15533, 15582, 15631, 15680, 15728, 15777, 15826, 15875, + 15923, 15972, 16021, 16070, 16118, 16167, 16216, 16265, + 16313, 16362, 16411, 16459, 16508, 16557, 16605, 16654, + 16702, 16751, 16800, 16848, 16897, 16945, 16994, 17042, + 17091, 17139, 17188, 17236, 17285, 17333, 17382, 17430, + 17479, 17527, 17576, 17624, 17672, 17721, 17769, 17818, + 17866, 17914, 17963, 18011, 18059, 18108, 18156, 18204, + 18253, 18301, 18349, 18397, 18446, 18494, 18542, 18590, + 18638, 18687, 18735, 18783, 18831, 18879, 18927, 18975, + 19024, 19072, 19120, 19168, 19216, 19264, 19312, 19360, + 19408, 19456, 19504, 19552, 19600, 19648, 19696, 19744, + 19792, 19840, 19888, 19935, 19983, 20031, 20079, 20127, + 20175, 20223, 20270, 20318, 20366, 20414, 20461, 20509, + 20557, 20605, 20652, 20700, 20748, 20795, 20843, 20891, + 20938, 20986, 21034, 21081, 21129, 21176, 21224, 21271, + 21319, 21367, 21414, 21462, 21509, 21557, 21604, 21651, + 21699, 21746, 21794, 21841, 21889, 21936, 21983, 22031, + 22078, 22125, 22173, 22220, 22267, 22314, 22362, 22409, + 22456, 22503, 22551, 22598, 22645, 22692, 22739, 22786, + 22833, 22881, 22928, 22975, 23022, 23069, 23116, 23163, + 23210, 23257, 23304, 23351, 23398, 23445, 23492, 23539, + 23586, 23632, 23679, 23726, 23773, 23820, 23867, 23914, + 23960, 24007, 24054, 24101, 24147, 24194, 24241, 24287, + 24334, 24381, 24427, 24474, 24521, 24567, 24614, 24660, + 24707, 24754, 24800, 24847, 24893, 24940, 24986, 25033, + 25079, 25125, 25172, 25218, 25265, 25311, 25357, 25404, + 25450, 25496, 25543, 25589, 25635, 25681, 25728, 25774, + 25820, 25866, 25913, 25959, 26005, 26051, 26097, 26143, + 26189, 26235, 26281, 26327, 26373, 26419, 26465, 26511, + 26557, 26603, 26649, 26695, 26741, 26787, 26833, 26879, + 26925, 26970, 27016, 27062, 27108, 27153, 27199, 27245, + 27291, 27336, 27382, 27428, 27473, 27519, 27565, 27610, + 27656, 27701, 27747, 27792, 27838, 27883, 27929, 27974, + 28020, 28065, 28111, 28156, 28201, 28247, 28292, 28337, + 28383, 28428, 28473, 28519, 28564, 28609, 28654, 28699, + 28745, 28790, 28835, 28880, 28925, 28970, 29015, 29060, + 29105, 29151, 29196, 29241, 29285, 29330, 29375, 29420, + 29465, 29510, 29555, 29600, 29645, 29690, 29734, 29779, + 29824, 29869, 29913, 29958, 30003, 30047, 30092, 30137, + 30181, 30226, 30271, 30315, 30360, 30404, 30449, 30493, + 30538, 30582, 30627, 30671, 30715, 30760, 30804, 30849, + 30893, 30937, 30982, 31026, 31070, 31114, 31159, 31203, + 31247, 31291, 31335, 31379, 31424, 31468, 31512, 31556, + 31600, 31644, 31688, 31732, 31776, 31820, 31864, 31908, + 31952, 31995, 32039, 32083, 32127, 32171, 32215, 32258, + 32302, 32346, 32390, 32433, 32477, 32521, 32564, 32608, + 32651, 32695, 32738, 32782, 32826, 32869, 32912, 32956, + 32999, 33043, 33086, 33130, 33173, 33216, 33260, 33303, + 33346, 33389, 33433, 33476, 33519, 33562, 33605, 33649, + 33692, 33735, 33778, 33821, 33864, 33907, 33950, 33993, + 34036, 34079, 34122, 34165, 34208, 34251, 34293, 34336, + 34379, 34422, 34465, 34507, 34550, 34593, 34635, 34678, + 34721, 34763, 34806, 34849, 34891, 34934, 34976, 35019, + 35061, 35104, 35146, 35188, 35231, 35273, 35316, 35358, + 35400, 35442, 35485, 35527, 35569, 35611, 35654, 35696, + 35738, 35780, 35822, 35864, 35906, 35948, 35990, 36032, + 36074, 36116, 36158, 36200, 36242, 36284, 36326, 36368, + 36409, 36451, 36493, 36535, 36576, 36618, 36660, 36701, + 36743, 36785, 36826, 36868, 36909, 36951, 36992, 37034, + 37075, 37117, 37158, 37200, 37241, 37282, 37324, 37365, + 37406, 37447, 37489, 37530, 37571, 37612, 37653, 37695, + 37736, 37777, 37818, 37859, 37900, 37941, 37982, 38023, + 38064, 38105, 38146, 38186, 38227, 38268, 38309, 38350, + 38390, 38431, 38472, 38512, 38553, 38594, 38634, 38675, + 38716, 38756, 38797, 38837, 38878, 38918, 38958, 38999, + 39039, 39080, 39120, 39160, 39201, 39241, 39281, 39321, + 39362, 39402, 39442, 39482, 39522, 39562, 39602, 39642, + 39682, 39722, 39762, 39802, 39842, 39882, 39922, 39962, + 40002, 40041, 40081, 40121, 40161, 40200, 40240, 40280, + 40319, 40359, 40399, 40438, 40478, 40517, 40557, 40596, + 40636, 40675, 40714, 40754, 40793, 40832, 40872, 40911, + 40950, 40990, 41029, 41068, 41107, 41146, 41185, 41224, + 41263, 41303, 41342, 41381, 41419, 41458, 41497, 41536, + 41575, 41614, 41653, 41692, 41730, 41769, 41808, 41846, + 41885, 41924, 41962, 42001, 42040, 42078, 42117, 42155, + 42194, 42232, 42271, 42309, 42347, 42386, 42424, 42462, + 42501, 42539, 42577, 42615, 42653, 42692, 42730, 42768, + 42806, 42844, 42882, 42920, 42958, 42996, 43034, 43072, + 43110, 43147, 43185, 43223, 43261, 43298, 43336, 43374, + 43412, 43449, 43487, 43524, 43562, 43600, 43637, 43675, + 43712, 43749, 43787, 43824, 43862, 43899, 43936, 43974, + 44011, 44048, 44085, 44122, 44160, 44197, 44234, 44271, + 44308, 44345, 44382, 44419, 44456, 44493, 44530, 44567, + 44603, 44640, 44677, 44714, 44750, 44787, 44824, 44861, + 44897, 44934, 44970, 45007, 45043, 45080, 45116, 45153, + 45189, 45226, 45262, 45298, 45335, 45371, 45407, 45443, + 45480, 45516, 45552, 45588, 45624, 45660, 45696, 45732, + 45768, 45804, 45840, 45876, 45912, 45948, 45984, 46019, + 46055, 46091, 46127, 46162, 46198, 46234, 46269, 46305, + 46340, 46376, 46411, 46447, 46482, 46518, 46553, 46589, + 46624, 46659, 46695, 46730, 46765, 46800, 46835, 46871, + 46906, 46941, 46976, 47011, 47046, 47081, 47116, 47151, + 47186, 47220, 47255, 47290, 47325, 47360, 47394, 47429, + 47464, 47498, 47533, 47568, 47602, 47637, 47671, 47706, + 47740, 47775, 47809, 47843, 47878, 47912, 47946, 47981, + 48015, 48049, 48083, 48117, 48151, 48185, 48219, 48254, + 48288, 48321, 48355, 48389, 48423, 48457, 48491, 48525, + 48558, 48592, 48626, 48660, 48693, 48727, 48760, 48794, + 48828, 48861, 48895, 48928, 48961, 48995, 49028, 49062, + 49095, 49128, 49161, 49195, 49228, 49261, 49294, 49327, + 49360, 49393, 49426, 49459, 49492, 49525, 49558, 49591, + 49624, 49657, 49690, 49722, 49755, 49788, 49820, 49853, + 49886, 49918, 49951, 49983, 50016, 50048, 50081, 50113, + 50146, 50178, 50210, 50242, 50275, 50307, 50339, 50371, + 50403, 50436, 50468, 50500, 50532, 50564, 50596, 50628, + 50660, 50691, 50723, 50755, 50787, 50819, 50850, 50882, + 50914, 50945, 50977, 51008, 51040, 51072, 51103, 51134, + 51166, 51197, 51229, 51260, 51291, 51323, 51354, 51385, + 51416, 51447, 51478, 51510, 51541, 51572, 51603, 51634, + 51665, 51695, 51726, 51757, 51788, 51819, 51850, 51880, + 51911, 51942, 51972, 52003, 52033, 52064, 52095, 52125, + 52155, 52186, 52216, 52247, 52277, 52307, 52338, 52368, + 52398, 52428, 52458, 52488, 52518, 52549, 52579, 52609, + 52639, 52668, 52698, 52728, 52758, 52788, 52818, 52847, + 52877, 52907, 52936, 52966, 52996, 53025, 53055, 53084, + 53114, 53143, 53172, 53202, 53231, 53260, 53290, 53319, + 53348, 53377, 53407, 53436, 53465, 53494, 53523, 53552, + 53581, 53610, 53639, 53667, 53696, 53725, 53754, 53783, + 53811, 53840, 53869, 53897, 53926, 53954, 53983, 54011, + 54040, 54068, 54097, 54125, 54153, 54182, 54210, 54238, + 54266, 54294, 54323, 54351, 54379, 54407, 54435, 54463, + 54491, 54519, 54546, 54574, 54602, 54630, 54658, 54685, + 54713, 54741, 54768, 54796, 54823, 54851, 54879, 54906, + 54933, 54961, 54988, 55015, 55043, 55070, 55097, 55124, + 55152, 55179, 55206, 55233, 55260, 55287, 55314, 55341, + 55368, 55395, 55422, 55448, 55475, 55502, 55529, 55555, + 55582, 55609, 55635, 55662, 55688, 55715, 55741, 55768, + 55794, 55820, 55847, 55873, 55899, 55925, 55952, 55978, + 56004, 56030, 56056, 56082, 56108, 56134, 56160, 56186, + 56212, 56237, 56263, 56289, 56315, 56340, 56366, 56392, + 56417, 56443, 56468, 56494, 56519, 56545, 56570, 56595, + 56621, 56646, 56671, 56697, 56722, 56747, 56772, 56797, + 56822, 56847, 56872, 56897, 56922, 56947, 56972, 56997, + 57022, 57046, 57071, 57096, 57120, 57145, 57170, 57194, + 57219, 57243, 57268, 57292, 57316, 57341, 57365, 57389, + 57414, 57438, 57462, 57486, 57510, 57534, 57558, 57582, + 57606, 57630, 57654, 57678, 57702, 57726, 57750, 57773, + 57797, 57821, 57844, 57868, 57892, 57915, 57939, 57962, + 57986, 58009, 58032, 58056, 58079, 58102, 58125, 58149, + 58172, 58195, 58218, 58241, 58264, 58287, 58310, 58333, + 58356, 58379, 58402, 58424, 58447, 58470, 58493, 58515, + 58538, 58560, 58583, 58605, 58628, 58650, 58673, 58695, + 58718, 58740, 58762, 58784, 58807, 58829, 58851, 58873, + 58895, 58917, 58939, 58961, 58983, 59005, 59027, 59049, + 59070, 59092, 59114, 59135, 59157, 59179, 59200, 59222, + 59243, 59265, 59286, 59308, 59329, 59350, 59372, 59393, + 59414, 59435, 59457, 59478, 59499, 59520, 59541, 59562, + 59583, 59604, 59625, 59645, 59666, 59687, 59708, 59728, + 59749, 59770, 59790, 59811, 59831, 59852, 59872, 59893, + 59913, 59934, 59954, 59974, 59994, 60015, 60035, 60055, + 60075, 60095, 60115, 60135, 60155, 60175, 60195, 60215, + 60235, 60254, 60274, 60294, 60313, 60333, 60353, 60372, + 60392, 60411, 60431, 60450, 60470, 60489, 60508, 60528, + 60547, 60566, 60585, 60604, 60624, 60643, 60662, 60681, + 60700, 60719, 60737, 60756, 60775, 60794, 60813, 60831, + 60850, 60869, 60887, 60906, 60924, 60943, 60961, 60980, + 60998, 61017, 61035, 61053, 61071, 61090, 61108, 61126, + 61144, 61162, 61180, 61198, 61216, 61234, 61252, 61270, + 61288, 61305, 61323, 61341, 61359, 61376, 61394, 61411, + 61429, 61446, 61464, 61481, 61499, 61516, 61533, 61551, + 61568, 61585, 61602, 61619, 61637, 61654, 61671, 61688, + 61705, 61721, 61738, 61755, 61772, 61789, 61805, 61822, + 61839, 61855, 61872, 61889, 61905, 61922, 61938, 61954, + 61971, 61987, 62003, 62020, 62036, 62052, 62068, 62084, + 62100, 62117, 62133, 62148, 62164, 62180, 62196, 62212, + 62228, 62244, 62259, 62275, 62291, 62306, 62322, 62337, + 62353, 62368, 62384, 62399, 62414, 62430, 62445, 62460, + 62475, 62491, 62506, 62521, 62536, 62551, 62566, 62581, + 62596, 62610, 62625, 62640, 62655, 62670, 62684, 62699, + 62714, 62728, 62743, 62757, 62772, 62786, 62800, 62815, + 62829, 62843, 62858, 62872, 62886, 62900, 62914, 62928, + 62942, 62956, 62970, 62984, 62998, 63012, 63026, 63039, + 63053, 63067, 63080, 63094, 63108, 63121, 63135, 63148, + 63162, 63175, 63188, 63202, 63215, 63228, 63241, 63254, + 63268, 63281, 63294, 63307, 63320, 63333, 63346, 63358, + 63371, 63384, 63397, 63410, 63422, 63435, 63447, 63460, + 63473, 63485, 63498, 63510, 63522, 63535, 63547, 63559, + 63571, 63584, 63596, 63608, 63620, 63632, 63644, 63656, + 63668, 63680, 63692, 63704, 63715, 63727, 63739, 63750, + 63762, 63774, 63785, 63797, 63808, 63820, 63831, 63842, + 63854, 63865, 63876, 63888, 63899, 63910, 63921, 63932, + 63943, 63954, 63965, 63976, 63987, 63998, 64009, 64019, + 64030, 64041, 64051, 64062, 64073, 64083, 64094, 64104, + 64115, 64125, 64135, 64146, 64156, 64166, 64176, 64186, + 64197, 64207, 64217, 64227, 64237, 64247, 64257, 64266, + 64276, 64286, 64296, 64305, 64315, 64325, 64334, 64344, + 64353, 64363, 64372, 64382, 64391, 64401, 64410, 64419, + 64428, 64437, 64447, 64456, 64465, 64474, 64483, 64492, + 64501, 64510, 64518, 64527, 64536, 64545, 64553, 64562, + 64571, 64579, 64588, 64596, 64605, 64613, 64622, 64630, + 64638, 64646, 64655, 64663, 64671, 64679, 64687, 64695, + 64703, 64711, 64719, 64727, 64735, 64743, 64751, 64758, + 64766, 64774, 64781, 64789, 64796, 64804, 64811, 64819, + 64826, 64834, 64841, 64848, 64855, 64863, 64870, 64877, + 64884, 64891, 64898, 64905, 64912, 64919, 64926, 64933, + 64939, 64946, 64953, 64959, 64966, 64973, 64979, 64986, + 64992, 64999, 65005, 65011, 65018, 65024, 65030, 65036, + 65043, 65049, 65055, 65061, 65067, 65073, 65079, 65085, + 65091, 65096, 65102, 65108, 65114, 65119, 65125, 65131, + 65136, 65142, 65147, 65153, 65158, 65163, 65169, 65174, + 65179, 65184, 65190, 65195, 65200, 65205, 65210, 65215, + 65220, 65225, 65230, 65235, 65239, 65244, 65249, 65253, + 65258, 65263, 65267, 65272, 65276, 65281, 65285, 65290, + 65294, 65298, 65302, 65307, 65311, 65315, 65319, 65323, + 65327, 65331, 65335, 65339, 65343, 65347, 65350, 65354, + 65358, 65362, 65365, 65369, 65372, 65376, 65379, 65383, + 65386, 65390, 65393, 65396, 65400, 65403, 65406, 65409, + 65412, 65415, 65418, 65421, 65424, 65427, 65430, 65433, + 65436, 65438, 65441, 65444, 65446, 65449, 65452, 65454, + 65457, 65459, 65461, 65464, 65466, 65468, 65471, 65473, + 65475, 65477, 65479, 65481, 65483, 65485, 65487, 65489, + 65491, 65493, 65495, 65496, 65498, 65500, 65501, 65503, + 65505, 65506, 65508, 65509, 65511, 65512, 65513, 65515, + 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, + 65524, 65525, 65526, 65527, 65528, 65529, 65529, 65530, 65531, 65531, 65532, 65532, 65533, 65533, 65534, 65534, 65534, 65535, 65535, 65535, 65535, 65535, 65535, 65535 }; From 0af32ee2fa6c83892a705c44bf3c61c09701367c Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 10 Jun 2015 13:42:45 -0400 Subject: [PATCH 24/30] Move garbage collection out of Lua hooks. That's supposed to be run once a frame, not once per hook per mobj per frame you moron. If you just run it seven thousand times a frame, of course your framerate will drop. --- src/d_main.c | 8 ++++++++ src/lua_hooklib.c | 17 ----------------- src/lua_hudlib.c | 4 ---- src/lua_infolib.c | 2 -- src/lua_script.c | 8 ++++++++ src/lua_script.h | 1 + 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 61255e272..3918d8118 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -96,6 +96,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "hardware/hw3sound.h" #endif +#ifdef HAVE_BLUA +#include "lua_script.h" +#endif + // platform independant focus loss UINT8 window_notinfocus = false; @@ -634,6 +638,10 @@ void D_SRB2Loop(void) #ifdef HW3SOUND HW3S_EndFrameUpdate(); #endif + +#ifdef HAVE_BLUA + LUA_Step(); +#endif } } diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 52c218000..0415d23e6 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -204,7 +204,6 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -238,7 +237,6 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -262,7 +260,6 @@ void LUAh_MapChange(void) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); } // Hook for map load @@ -285,7 +282,6 @@ void LUAh_MapLoad(void) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); } // Hook for Got_AddPlayer @@ -308,7 +304,6 @@ void LUAh_PlayerJoin(int playernum) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCCOLLECT, 0); } // Hook for frame (after mobj and player thinkers) @@ -330,8 +325,6 @@ void LUAh_ThinkFrame(void) hookp->error = true; } } - - lua_gc(gL, LUA_GCSTEP, 1); } // Hook for mobj collisions @@ -375,7 +368,6 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return shouldCollide; } @@ -415,7 +407,6 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -464,7 +455,6 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return shouldDamage; } @@ -508,7 +498,6 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -550,7 +539,6 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -589,7 +577,6 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -651,7 +638,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -685,7 +671,6 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -739,7 +724,6 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } @@ -781,7 +765,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) } lua_settop(gL, 0); - lua_gc(gL, LUA_GCSTEP, 1); return hooked; } diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 86ff11337..5a83d95b5 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -674,8 +674,6 @@ void LUAh_GameHUD(player_t *stplayr) LUA_Call(gL, 3); } lua_pop(gL, -1); - lua_gc(gL, LUA_GCCOLLECT, 0); - hud_running = false; } @@ -701,8 +699,6 @@ void LUAh_ScoresHUD(void) LUA_Call(gL, 1); } lua_pop(gL, -1); - lua_gc(gL, LUA_GCCOLLECT, 0); - hud_running = false; } diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 2dc14d6fc..0fddebaba 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -137,8 +137,6 @@ static void A_Lua(mobj_t *actor) --superstack; superactions[superstack] = NULL; } - - lua_gc(gL, LUA_GCSTEP, 1); } // Arbitrary states[] table index -> state_t * diff --git a/src/lua_script.c b/src/lua_script.c index a5b56bf71..145104d9a 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -939,6 +939,14 @@ static void NetArchiveHook(lua_CFunction archFunc) lua_pop(gL, 2); } +void LUA_Step(void) +{ + if (!gL) + return; + lua_settop(gL, 0); + lua_gc(gL, LUA_GCSTEP, 1); +} + void LUA_Archive(void) { INT32 i; diff --git a/src/lua_script.h b/src/lua_script.h index 8437045ec..292160a0b 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -48,6 +48,7 @@ void LUA_InvalidateUserdata(void *data); void LUA_InvalidateLevel(void); void LUA_InvalidateMapthings(void); void LUA_InvalidatePlayer(player_t *player); +void LUA_Step(void); void LUA_Archive(void); void LUA_UnArchive(void); void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c From 45515df7904621c053f4fca194579abe0014a5cb Mon Sep 17 00:00:00 2001 From: STJrInuyasha Date: Sat, 13 Jun 2015 15:56:28 -0700 Subject: [PATCH 25/30] Make sure "word" in readlevelheader gets reset ... because some things (Lua. custom header entries) move it. https://mb.srb2.org/showthread.php?t=40580 (Technically breaks netgame compatibility for Lua-heavy mods, so in next.) --- src/dehacked.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 513079e6e..6013290ef 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -998,7 +998,7 @@ static const struct { static void readlevelheader(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word = s; + char *word; char *word2; //char *word3; // Non-uppercase version of word2 char *tmp; @@ -1027,6 +1027,9 @@ static void readlevelheader(MYFILE *f, INT32 num) if (s == tmp) continue; // Skip comment lines, but don't break. + // Set / reset word, because some things (Lua.) move it + word = s; + // Get the part before the " = " tmp = strchr(s, '='); *(tmp-1) = '\0'; From f0054be951629f881ae94e0a736d6e7de7c2a641 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 18 Jun 2015 10:01:57 -0400 Subject: [PATCH 26/30] whitespace fixup --- src/hardware/hw_md2.c | 2 +- src/p_map.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index de648f1b9..67720231c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -926,7 +926,7 @@ void HWR_InitMD2(void) CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n"); continue; } - + for (i = 0; i < NUMSPRITES; i++) { if (stricmp(name, sprnames[i]) == 0) diff --git a/src/p_map.c b/src/p_map.c index 6eb1262fa..d6acf1510 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -121,7 +121,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) /*Someone want to make these work like bumpers?*/ return; } - + object->eflags |= MFE_SPRUNG; // apply this flag asap! spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify From 48d759123d6cb101f2ffedc193e0efe4811d89b3 Mon Sep 17 00:00:00 2001 From: Wolfy Date: Fri, 20 Feb 2015 17:25:27 -0600 Subject: [PATCH 27/30] Have super sparks scale with the player Fixes https://mb.srb2.org/showthread.php?t=40279 Should work fine, but do keep in mind that this fix is untested. --- src/p_user.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 6844d2cba..3d77069ac 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3330,6 +3330,7 @@ firenormal: // static void P_DoSuperStuff(player_t *player) { + mobj_t *spark; ticcmd_t *cmd = &player->cmd; if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) return; // don't do anything right now, we're in the middle of transforming! @@ -3396,7 +3397,11 @@ static void P_DoSuperStuff(player_t *player) if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) - P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK); + { + spark = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK); + spark->destscale = player->mo->scale; + P_SetScale(spark, player->mo->scale); + } G_GhostAddColor(GHC_SUPER); From 61388459302db4cd328f48fcc972e776d842a02c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 21 Jun 2015 16:58:34 +0100 Subject: [PATCH 28/30] Removed all "-1"s from R_PointToAngle and R_PointToAngle2, in order to allow ALL basic compass directions at the least to be given the right angle by these functions. Note: Before this change, North and West directions would be returned as ANGLE_90-1 and ANGLE_180-1. This caused the pusher polyobjects in THZ2 to slowly move sideways as a side-effect (and probably caused similar bugs in the past too, these functions have barely been touched in a decade it turns out.) --- src/r_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 1edcb815b..19a6b5cba 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -316,13 +316,13 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; } @@ -332,13 +332,13 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; } From fa935be129728a82fd30104d507aa81258e1e8ce Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 28 Jul 2015 19:28:51 +0100 Subject: [PATCH 29/30] Fixed the issue where diagonal springs couldn't teleport you to their centers anymore (guess whose fault that was! =D ). Basically I just made P_DoSpring boolean, which probably could be useful to Lua peeps as well. (it returns true if you were sprung, false if not) --- src/lua_baselib.c | 4 ++-- src/p_local.h | 2 +- src/p_map.c | 24 ++++++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d76839e73..5e2d31b10 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1009,8 +1009,8 @@ static int lib_pDoSpring(lua_State *L) NOHUD if (!spring || !object) return LUA_ErrInvalid(L, "mobj_t"); - P_DoSpring(spring, object); - return 0; + lua_pushboolean(L, P_DoSpring(spring, object)); + return 1; } // P_INTER diff --git a/src/p_local.h b/src/p_local.h index 59179c1c1..f76384264 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -316,7 +316,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist); fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height); boolean PIT_PushableMoved(mobj_t *thing); -void P_DoSpring(mobj_t *spring, mobj_t *object); +boolean P_DoSpring(mobj_t *spring, mobj_t *object); // // P_SETUP diff --git a/src/p_map.c b/src/p_map.c index b44b89974..b2a4b36de 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -102,7 +102,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) // MOVEMENT ITERATOR FUNCTIONS // ========================================================================= -void P_DoSpring(mobj_t *spring, mobj_t *object) +boolean P_DoSpring(mobj_t *spring, mobj_t *object) { INT32 pflags; fixed_t offx, offy; @@ -110,16 +110,16 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) fixed_t horizspeed = spring->info->damage; if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic - return; + return false; // Spectators don't trigger springs. if (object->player && object->player->spectator) - return; + return false; if (object->player && (object->player->pflags & PF_NIGHTSMODE)) { /*Someone want to make these work like bumpers?*/ - return; + return false; } object->eflags |= MFE_SPRUNG; // apply this flag asap! @@ -209,6 +209,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) P_SetPlayerMobjState(object, S_PLAY_ATK1); } } + return true; } static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) @@ -365,6 +366,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) static boolean PIT_CheckThing(mobj_t *thing) { fixed_t blockdist; + boolean iwassprung = false; // don't clip against self if (thing == tmthing) @@ -819,7 +821,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } } @@ -906,7 +908,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } // Are you touching the side of the object you're interacting with? else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height @@ -928,12 +930,14 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - - if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)); - else + if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)) + { + if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... + return false; // "cancel" P_TryMove via blocking so you keep your current position + } // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team - if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) ; // z checking at last From f8b439769ad190552a804273728da40f1a7c347c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Aug 2015 13:00:49 +0100 Subject: [PATCH 30/30] Fixed Tag and H&S getting each other's suicide behaviors by mistake. --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 478bd459c..e9512e960 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1988,7 +1988,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) // allow them to try again, rather than sitting the whole thing out. if (leveltime >= hidetime * TICRATE) { - if (gametype == GT_HIDEANDSEEK)//suiciding in survivor makes you IT. + if (gametype == GT_TAG)//suiciding in survivor makes you IT. { target->player->pflags |= PF_TAGIT; CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it!