From 7f920c5541a07276c8fcf254346fce3e8c7eb458 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 25 May 2012 05:14:19 +0000 Subject: [PATCH] Add EVENT_LOADGAME and EVENT_SAVEGAME, self-explanatory. Also make EVENT_NEWGAME use myconnectindex for player ID instead of screenpeek. git-svn-id: https://svn.eduke32.com/eduke32@2688 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 4 +++- polymer/eduke32/source/gameexec.h | 2 ++ polymer/eduke32/source/lunatic/defs.ilua | 2 ++ polymer/eduke32/source/premap.c | 2 +- polymer/eduke32/source/savegame.c | 4 ++++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 709cbb2b6..4904a7699 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -663,7 +663,9 @@ const tokenlist EventNames[MAXEVENTS] = { "EVENT_NEWGAME", EVENT_NEWGAME }, { "EVENT_SOUND", EVENT_SOUND }, { "EVENT_CHECKTOUCHDAMAGE", EVENT_CHECKTOUCHDAMAGE }, - { "EVENT_CHECKFLOORDAMAGE", EVENT_CHECKFLOORDAMAGE } + { "EVENT_CHECKFLOORDAMAGE", EVENT_CHECKFLOORDAMAGE }, + { "EVENT_LOADGAME", EVENT_LOADGAME }, + { "EVENT_SAVEGAME", EVENT_SAVEGAME } }; const memberlabel_t SectorLabels[]= diff --git a/polymer/eduke32/source/gameexec.h b/polymer/eduke32/source/gameexec.h index fe416efd4..21a437cc4 100644 --- a/polymer/eduke32/source/gameexec.h +++ b/polymer/eduke32/source/gameexec.h @@ -121,6 +121,8 @@ enum GameEvent_t { EVENT_SOUND, EVENT_CHECKTOUCHDAMAGE, EVENT_CHECKFLOORDAMAGE, + EVENT_LOADGAME, + EVENT_SAVEGAME, MAXEVENTS }; diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 1ed7e0b84..175d237e9 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -364,6 +364,8 @@ enum GameEvent_t { EVENT_SOUND, EVENT_CHECKTOUCHDAMAGE, EVENT_CHECKFLOORDAMAGE, + EVENT_LOADGAME, + EVENT_SAVEGAME, MAXEVENTS }; ]] diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 3d55c7f76..5c680be23 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1563,7 +1563,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk) display_mirror = 0; - VM_OnEvent(EVENT_NEWGAME, g_player[screenpeek].ps->i, screenpeek, -1, 0); + VM_OnEvent(EVENT_NEWGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0); } static void resetpspritevars(char g) diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 971ff2d75..02cb17cc8 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -299,6 +299,8 @@ int32_t G_LoadPlayer(int32_t spot) sv_postudload(); // ud.m_XXX = ud.XXX + VM_OnEvent(EVENT_LOADGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0); + return 0; } @@ -342,6 +344,8 @@ int32_t G_SavePlayer(int32_t spot) polymer_resetlights(); #endif + VM_OnEvent(EVENT_SAVEGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0); + // SAVE! sv_saveandmakesnapshot(fil, spot, 0, 0, 0);