diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index baecfb0b3..29f81becc 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -99,6 +99,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_UNDEFINELEVEL, 20150208 }, { CON_IFCUTSCENE, 20150210 }, { CON_DEFINEVOLUMEFLAGS, 20150222 }, + { CON_RESETPLAYERFLAGS, 20150303 }, }; #endif @@ -561,6 +562,7 @@ const char *keyw[] = "startcutscene", // 378 "ifcutscene", // 379 "definevolumeflags", // 380 + "resetplayerflags", // 381 "" }; #endif @@ -4183,6 +4185,7 @@ static int32_t C_ParseCommand(int32_t loop) case CON_SETPLAYERANGLE: case CON_SETMUSICPOSITION: case CON_STARTCUTSCENE: + case CON_RESETPLAYERFLAGS: C_GetNextVar(); continue; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 6c3baa98a..800683326 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -986,6 +986,7 @@ enum ScriptKeywords_t CON_STARTCUTSCENE, // 378 CON_IFCUTSCENE, // 379 CON_DEFINEVOLUMEFLAGS, // 380 + CON_RESETPLAYERFLAGS, // 381 CON_END }; // KEEPINSYNC with the keyword list in lunatic/con_lang.lua diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index dcef5a5d1..c60024faf 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1034,12 +1034,12 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp) g_sp->zvel = 0; } -static int32_t VM_ResetPlayer(int32_t g_p, int32_t g_flags) +static int32_t VM_ResetPlayer(int32_t g_p, int32_t g_flags, int32_t flags) { //AddLog("resetplayer"); if (!g_netServer && ud.multimode < 2) { - if (g_lastSaveSlot >= 0 && ud.recstat != 2) + if (g_lastSaveSlot >= 0 && ud.recstat != 2 && !(flags & 1)) { M_OpenMenu(g_p); KB_ClearKeyDown(sc_Space); @@ -3362,11 +3362,14 @@ nullquote: continue; case CON_RESETPLAYER: - { insptr++; - vm.g_flags = VM_ResetPlayer(vm.g_p, vm.g_flags); - } - continue; + vm.g_flags = VM_ResetPlayer(vm.g_p, vm.g_flags, 0); + continue; + + case CON_RESETPLAYERFLAGS: + insptr++; + vm.g_flags = VM_ResetPlayer(vm.g_p, vm.g_flags, Gv_GetVarX(*insptr++)); + continue; case CON_IFONWATER: VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == ST_1_ABOVE_WATER && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8)); @@ -5708,9 +5711,9 @@ void VM_FallSprite(int32_t i) VM_Fall(i, &sprite[i]); } -int32_t VM_ResetPlayer2(int32_t snum) +int32_t VM_ResetPlayer2(int32_t snum, int32_t flags) { - return VM_ResetPlayer(snum, 0); + return VM_ResetPlayer(snum, 0, flags); } int32_t VM_CheckSquished2(int32_t i, int32_t snum) diff --git a/polymer/eduke32/source/gameexec.h b/polymer/eduke32/source/gameexec.h index a61672fab..69fe8aedb 100644 --- a/polymer/eduke32/source/gameexec.h +++ b/polymer/eduke32/source/gameexec.h @@ -104,7 +104,7 @@ void G_ShowView(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32 int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp); void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap); void VM_FallSprite(int32_t i); -int32_t VM_ResetPlayer2(int32_t snum); +int32_t VM_ResetPlayer2(int32_t snum, int32_t flags); int32_t VM_CheckSquished2(int32_t i, int32_t snum); #endif diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index f43d9ce61..367aec81e 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -1028,6 +1028,7 @@ lpeg.P(false) + "return" + "respawnhitag" + "resizearray" + +"resetplayerflags" + "resetplayer" + "resetcount" + "resetactioncount" + diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index b305ef9d6..c582a5793 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -1187,9 +1187,9 @@ function _pkick(ps, spr) end end -function _VM_ResetPlayer2(snum) +function _VM_ResetPlayer2(snum, flags) check_player_idx(snum) - return (CF.VM_ResetPlayer2(snum)~=0) + return (CF.VM_ResetPlayer2(snum, flags)~=0) end local PALBITS = { [0]=1, [21]=2, [23]=4 } diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index d3872f64d..ea1c9f8e7 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -2710,7 +2710,9 @@ local Cinner = { resetcount = cmd() / ACS":set_count(0)", resetplayer = cmd() -- NLCF - / "if (_con._VM_ResetPlayer2(_pli,_aci)) then _con.longjmp() end", + / "if (_con._VM_ResetPlayer2(_pli,0)) then _con.longjmp() end", + resetplayerflags = cmd(R) -- NLCF + / "if (_con._VM_ResetPlayer2(_pli,%1)) then _con.longjmp() end", respawnhitag = cmd() / format("_con._respawnhitag(%s)", SPS""), tip = cmd() diff --git a/polymer/eduke32/source/lunatic/lunatic_game.c b/polymer/eduke32/source/lunatic/lunatic_game.c index 1191bbcab..ed209d59b 100644 --- a/polymer/eduke32/source/lunatic/lunatic_game.c +++ b/polymer/eduke32/source/lunatic/lunatic_game.c @@ -359,7 +359,7 @@ extern void P_CheckWeaponI(int32_t snum); extern int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel); extern int32_t A_Spawn(int32_t j, int32_t pn); extern void VM_FallSprite(int32_t i); -extern int32_t VM_ResetPlayer2(int32_t snum); +extern int32_t VM_ResetPlayer2(int32_t snum, int32_t flags); extern void A_RadiusDamage(int32_t i, int32_t r, int32_t, int32_t, int32_t, int32_t); extern void G_OperateSectors(int32_t sn, int32_t ii); extern void G_OperateActivators(int32_t low,int32_t snum); @@ -410,7 +410,7 @@ DEFINE_VOID_CFUNC(P_CheckWeaponI, ONE_ARG) DEFINE_RET_CFUNC(A_ShootWithZvel, THREE_ARGS) DEFINE_RET_CFUNC(A_Spawn, TWO_ARGS) DEFINE_VOID_CFUNC(VM_FallSprite, ONE_ARG) -DEFINE_RET_CFUNC(VM_ResetPlayer2, ONE_ARG) +DEFINE_RET_CFUNC(VM_ResetPlayer2, TWO_ARGS) DEFINE_VOID_CFUNC(A_RadiusDamage, LARG(1), LARG(2), LARG(3), LARG(4), LARG(5), LARG(6)) DEFINE_VOID_CFUNC(G_OperateSectors, TWO_ARGS) DEFINE_VOID_CFUNC(G_OperateActivators, TWO_ARGS)