Add EVENT_RESETGOTPICS which gives scripts the chance to reset gotpics (and similar effects trackers) for effects that run in EVENT_DISPLAYROOMS.

EVENT_RESETGOTPICS is called after the last call to EVENT_DISPLAYROOMS in a frame, but before any engine-side calls to renderDrawRoomsQ16()

git-svn-id: https://svn.eduke32.com/eduke32@7734 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-06-25 18:35:08 +00:00 committed by Christoph Oelckers
parent cdd83905ca
commit c2340dd409
4 changed files with 12 additions and 1 deletions

View file

@ -156,6 +156,7 @@ enum GameEvent_t {
EVENT_DAMAGEFLOOR, EVENT_DAMAGEFLOOR,
EVENT_DAMAGECEILING, EVENT_DAMAGECEILING,
EVENT_DISPLAYROOMSCAMERATILE, EVENT_DISPLAYROOMSCAMERATILE,
EVENT_RESETGOTPICS,
#ifdef LUNATIC #ifdef LUNATIC
EVENT_ANIMATEALLSPRITES, EVENT_ANIMATEALLSPRITES,
#endif #endif

View file

@ -582,6 +582,10 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz
// NOTE: We can have g_mirrorCount==0 but gotpic'd MIRROR, // NOTE: We can have g_mirrorCount==0 but gotpic'd MIRROR,
// for example in LNGA2. // for example in LNGA2.
gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7));
//give scripts the chance to reset gotpics for effects that run in EVENT_DISPLAYROOMS
//EVENT_RESETGOTPICS must be called after the last call to EVENT_DISPLAYROOMS in a frame, but before any engine-side renderDrawRoomsQ16
VM_OnEvent(EVENT_RESETGOTPICS, -1, -1);
return; return;
} }
@ -651,6 +655,10 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz
CAMERA(q16ang) = origCamq16ang; CAMERA(q16ang) = origCamq16ang;
CAMERA(q16horiz) = origCamq16horiz; CAMERA(q16horiz) = origCamq16horiz;
//give scripts the chance to reset gotpics for effects that run in EVENT_DISPLAYROOMS
//EVENT_RESETGOTPICS must be called after the last call to EVENT_DISPLAYROOMS in a frame, but before any engine-side renderDrawRoomsQ16
VM_OnEvent(EVENT_RESETGOTPICS, -1, -1);
//prepare to render the mirror //prepare to render the mirror
renderPrepareMirror(x, y, a, g_mirrorWall[i], &tposx, &tposy, &tang); renderPrepareMirror(x, y, a, g_mirrorWall[i], &tposx, &tposy, &tang);

View file

@ -983,6 +983,7 @@ const char *EventNames[MAXEVENTS] =
"EVENT_DAMAGEFLOOR", "EVENT_DAMAGEFLOOR",
"EVENT_DAMAGECEILING", "EVENT_DAMAGECEILING",
"EVENT_DISPLAYROOMSCAMERATILE", "EVENT_DISPLAYROOMSCAMERATILE",
"EVENT_RESETGOTPICS",
#ifdef LUNATIC #ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES", "EVENT_ANIMATEALLSPRITES",
#endif #endif

View file

@ -192,11 +192,12 @@ EVENT = {
EVENT_DISPLAYSCUBA = 112, EVENT_DISPLAYSCUBA = 112,
EVENT_DISPLAYTIP = 113, EVENT_DISPLAYTIP = 113,
EVENT_DISPLAYACCESS = 114, EVENT_DISPLAYACCESS = 114,
EVENT_RESETGOTPICS = 115,
-- EVENT_ANIMATEALLSPRITES = previous+1, -- internal -- EVENT_ANIMATEALLSPRITES = previous+1, -- internal
-- KEEPINSYNC with MAXEVENTS below -- KEEPINSYNC with MAXEVENTS below
} }
MAXEVENTS = 115 -- KEEPINSYNC with above EVENT_* list MAXEVENTS = 116 -- KEEPINSYNC with above EVENT_* list
-- NOTE: negated values are not exported to the ffi.C namespace or CON. -- NOTE: negated values are not exported to the ffi.C namespace or CON.
-- See TWEAK_SFLAG below. -- See TWEAK_SFLAG below.