Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
Show changes
Commits on Source (6)
...@@ -114,6 +114,7 @@ ENUM (STRING_HOOK); ...@@ -114,6 +114,7 @@ ENUM (STRING_HOOK);
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist)) #define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
extern boolean hook_cmd_running; extern boolean hook_cmd_running;
extern int hook_defrosting;
void LUA_HookVoid(int hook); void LUA_HookVoid(int hook);
void LUA_HookHUD(int hook, huddrawlist_h drawlist); void LUA_HookHUD(int hook, huddrawlist_h drawlist);
......
...@@ -25,25 +25,35 @@ ...@@ -25,25 +25,35 @@
static int lib_iteratePlayers(lua_State *L) static int lib_iteratePlayers(lua_State *L)
{ {
INT32 i = -1; INT32 i = -1;
if (lua_gettop(L) < 2) if (lua_gettop(L) < 2)
{ {
//return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do <block> end'."); //return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do <block> end'.");
lua_pushcfunction(L, lib_iteratePlayers); lua_pushcfunction(L, lib_iteratePlayers);
return 1; return 1;
} }
lua_settop(L, 2); lua_settop(L, 2);
lua_remove(L, 1); // state is unused. lua_remove(L, 1); // state is unused.
if (!lua_isnil(L, 1)) if (!lua_isnil(L, 1))
i = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players); i = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players);
for (i++; i < MAXPLAYERS; i++)
i++;
if (i == serverplayer)
{
return LUA_PushServerPlayer(L);
}
for (; i < MAXPLAYERS; i++)
{ {
if (!playeringame[i]) if (!playeringame[i])
continue; continue;
if (!players[i].mo)
continue;
LUA_PushUserdata(L, &players[i], META_PLAYER); LUA_PushUserdata(L, &players[i], META_PLAYER);
return 1; return 1;
} }
return 0; return 0;
} }
...@@ -56,10 +66,10 @@ static int lib_getPlayer(lua_State *L) ...@@ -56,10 +66,10 @@ static int lib_getPlayer(lua_State *L)
lua_Integer i = luaL_checkinteger(L, 2); lua_Integer i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXPLAYERS) if (i < 0 || i >= MAXPLAYERS)
return luaL_error(L, "players[] index %d out of range (0 - %d)", i, MAXPLAYERS-1); return luaL_error(L, "players[] index %d out of range (0 - %d)", i, MAXPLAYERS-1);
if (i == serverplayer)
return LUA_PushServerPlayer(L);
if (!playeringame[i]) if (!playeringame[i])
return 0; return 0;
if (!players[i].mo)
return 0;
LUA_PushUserdata(L, &players[i], META_PLAYER); LUA_PushUserdata(L, &players[i], META_PLAYER);
return 1; return 1;
} }
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
lua_State *gL = NULL; lua_State *gL = NULL;
int hook_defrosting;
// List of internal libraries to load from SRB2 // List of internal libraries to load from SRB2
static lua_CFunction liblist[] = { static lua_CFunction liblist[] = {
LUA_EnumLib, // global metatable for enums LUA_EnumLib, // global metatable for enums
...@@ -339,6 +341,9 @@ int LUA_PushGlobals(lua_State *L, const char *word) ...@@ -339,6 +341,9 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word,"leveltime")) { } else if (fastcmp(word,"leveltime")) {
lua_pushinteger(L, leveltime); lua_pushinteger(L, leveltime);
return 1; return 1;
} else if (fastcmp(word,"defrosting")) {
lua_pushinteger(L, hook_defrosting);
return 1;
} else if (fastcmp(word,"sstimer")) { } else if (fastcmp(word,"sstimer")) {
lua_pushinteger(L, sstimer); lua_pushinteger(L, sstimer);
return 1; return 1;
...@@ -365,6 +370,8 @@ int LUA_PushGlobals(lua_State *L, const char *word) ...@@ -365,6 +370,8 @@ int LUA_PushGlobals(lua_State *L, const char *word)
return 1; return 1;
// local player variables, by popular request // local player variables, by popular request
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1) } else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
if (consoleplayer == serverplayer)
return LUA_PushServerPlayer(L);
if (!addedtogame || consoleplayer < 0 || !playeringame[consoleplayer]) if (!addedtogame || consoleplayer < 0 || !playeringame[consoleplayer])
return 0; return 0;
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
...@@ -387,10 +394,7 @@ int LUA_PushGlobals(lua_State *L, const char *word) ...@@ -387,10 +394,7 @@ int LUA_PushGlobals(lua_State *L, const char *word)
return 1; return 1;
// end local player variables // end local player variables
} else if (fastcmp(word,"server")) { } else if (fastcmp(word,"server")) {
if ((!multiplayer || !netgame) && !playeringame[serverplayer]) return LUA_PushServerPlayer(L);
return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1;
} else if (fastcmp(word,"emeralds")) { } else if (fastcmp(word,"emeralds")) {
lua_pushinteger(L, emeralds); lua_pushinteger(L, emeralds);
return 1; return 1;
...@@ -832,6 +836,14 @@ lpushed_t LUA_RawPushUserdata(lua_State *L, void *data) ...@@ -832,6 +836,14 @@ lpushed_t LUA_RawPushUserdata(lua_State *L, void *data)
return status; return status;
} }
int LUA_PushServerPlayer(lua_State *L)
{
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1;
}
// When userdata is freed, use this function to remove it from Lua. // When userdata is freed, use this function to remove it from Lua.
void LUA_InvalidateUserdata(void *data) void LUA_InvalidateUserdata(void *data)
{ {
......
...@@ -50,6 +50,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump, boolean noresults); ...@@ -50,6 +50,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump, boolean noresults);
void LUA_DumpFile(const char *filename); void LUA_DumpFile(const char *filename);
#endif #endif
fixed_t LUA_EvalMath(const char *word); fixed_t LUA_EvalMath(const char *word);
int LUA_PushServerPlayer(lua_State *L);
void LUA_Step(void); void LUA_Step(void);
void LUA_Archive(void); void LUA_Archive(void);
void LUA_UnArchive(void); void LUA_UnArchive(void);
......
...@@ -910,7 +910,7 @@ void P_Ticker(boolean run) ...@@ -910,7 +910,7 @@ void P_Ticker(boolean run)
// Abbreviated ticker for pre-loading, calls thinkers and assorted things // Abbreviated ticker for pre-loading, calls thinkers and assorted things
void P_PreTicker(INT32 frames) void P_PreTicker(INT32 frames)
{ {
INT32 i,framecnt; INT32 i;
ticcmd_t temptic; ticcmd_t temptic;
postimgtype = postimgtype2 = postimg_none; postimgtype = postimgtype2 = postimg_none;
...@@ -918,7 +918,9 @@ void P_PreTicker(INT32 frames) ...@@ -918,7 +918,9 @@ void P_PreTicker(INT32 frames)
if (marathonmode & MA_INGAME) if (marathonmode & MA_INGAME)
marathonmode |= MA_INIT; marathonmode |= MA_INIT;
for (framecnt = 0; framecnt < frames; ++framecnt) hook_defrosting = frames;
while (hook_defrosting)
{ {
P_MapStart(); P_MapStart();
...@@ -967,6 +969,8 @@ void P_PreTicker(INT32 frames) ...@@ -967,6 +969,8 @@ void P_PreTicker(INT32 frames)
R_ResetViewInterpolation(0); R_ResetViewInterpolation(0);
P_MapEnd(); P_MapEnd();
hook_defrosting--;
} }
if (marathonmode & MA_INGAME) if (marathonmode & MA_INGAME)
......