From fd78e9f95441480cb5a3e55a5826af004d87af40 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 16 Jun 2014 23:16:55 +0000 Subject: [PATCH] By request, implement EVENT_ACTIVATECHEAT. git-svn-id: https://svn.eduke32.com/eduke32@4515 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 9 +++++++++ polymer/eduke32/source/gamedef.c | 1 + polymer/eduke32/source/gameexec.h | 1 + polymer/eduke32/source/lunatic/con_lang.lua | 3 ++- polymer/eduke32/source/lunatic/defs.ilua | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 02d730ef4..89e85700f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -8160,6 +8160,11 @@ GAME_STATIC void G_DoCheats(void) return; FOUNDCHEAT: + + i = VM_OnEvent(EVENT_ACTIVATECHEAT, g_player[myconnectindex].ps->i, myconnectindex, -1, k); + if (k != CHEAT_COMEGETSOME) // Users are not allowed to interfere with TX's debugging cheat. + k = i; + { switch (k) { @@ -8475,6 +8480,10 @@ FOUNDCHEAT: g_player[myconnectindex].ps->gm |= MODE_EOL; KB_FlushKeyboardQueue(); return; + + default: + end_cheat(); + return; } } } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 689b7e6f0..7e1bed000 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -697,6 +697,7 @@ const char *EventNames[MAXEVENTS] = "EVENT_PREGAME", "EVENT_CHANGEMENU", "EVENT_DAMAGEHPLANE", + "EVENT_ACTIVATECHEAT", #ifdef LUNATIC "EVENT_ANIMATEALLSPRITES", #endif diff --git a/polymer/eduke32/source/gameexec.h b/polymer/eduke32/source/gameexec.h index 6cc190870..b284807fc 100644 --- a/polymer/eduke32/source/gameexec.h +++ b/polymer/eduke32/source/gameexec.h @@ -126,6 +126,7 @@ enum GameEvent_t { EVENT_PREGAME, EVENT_CHANGEMENU, EVENT_DAMAGEHPLANE, // 95 + EVENT_ACTIVATECHEAT, #ifdef LUNATIC EVENT_ANIMATEALLSPRITES, #endif diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index c86a7b2a0..874d1f4cf 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -170,7 +170,8 @@ EVENT = { EVENT_PREGAME = 93, EVENT_CHANGEMENU = 94, EVENT_DAMAGEHPLANE = 95, --- EVENT_ANIMATEALLSPRITES = 96, -- internal + EVENT_ACTIVATECHEAT = 96, +-- EVENT_ANIMATEALLSPRITES = 97, -- internal } -- NOTE: negated values are not exported to the ffi.C namespace or CON. diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 7352b715b..98b292e95 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -2112,7 +2112,7 @@ local function our_gameactor(args) -- Register our EVENT_ANIMATEALLSPRITES only now so that it is not -- called if there are no 'animate' definitions. - gameevent_internal(96, animate_all_sprites) -- EVENT_ANIMATEALLSPRITES + gameevent_internal(97, animate_all_sprites) -- EVENT_ANIMATEALLSPRITES end -- All good, bitwise-OR the tile bits and register the actor!