From 9b17be7f3e7d626b808f29b9e64ed1e566d38974 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 22 Jan 2019 17:56:34 +0000 Subject: [PATCH] CON: Add EVENT_DISPLAYROOMSCAMERATILE git-svn-id: https://svn.eduke32.com/eduke32@7313 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/events_defs.h | 1 + source/duke3d/src/game.cpp | 10 ++++++---- source/duke3d/src/gamedef.cpp | 1 + source/duke3d/src/sector.cpp | 11 +++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/source/duke3d/src/events_defs.h b/source/duke3d/src/events_defs.h index 5fc039b2b..a6f0cd334 100644 --- a/source/duke3d/src/events_defs.h +++ b/source/duke3d/src/events_defs.h @@ -155,6 +155,7 @@ enum GameEvent_t { EVENT_DAMAGEWALL, EVENT_DAMAGEFLOOR, EVENT_DAMAGECEILING, + EVENT_DISPLAYROOMSCAMERATILE, #ifdef LUNATIC EVENT_ANIMATEALLSPRITES, #endif diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 67a24b8fd..07bc96ee5 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -756,13 +756,15 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) CAMERA(q16ang) = fix16_from_int(actor[ud.camerasprite].tempang + mulscale16(((pSprite->ang + 1024 - actor[ud.camerasprite].tempang) & 2047) - 1024, smoothRatio)); - int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERA, pPlayer->i, playerNum, 0); + int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERA, ud.camerasprite, playerNum, 0); if (noDraw != 1) // event return values other than 0 and 1 are reserved { +#ifdef DEBUGGINGAIDS if (EDUKE32_PREDICT_FALSE(noDraw != 0)) OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMSCAMERA return value must be 0 or 1, " "other values are reserved.\n"); +#endif #ifdef LEGACY_ROR G_SE40(smoothRatio); @@ -1016,11 +1018,11 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (noDraw != 1) // event return values other than 0 and 1 are reserved { -/* - if (EDUKE32_PREDICT_FALSE(dont_draw != 0)) +#ifdef DEBUGGINGAIDS + if (EDUKE32_PREDICT_FALSE(noDraw != 0)) OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, " "other values are reserved.\n"); -*/ +#endif G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(q16ang), CAMERA(q16horiz), smoothRatio); #ifdef LEGACY_ROR diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index d3bb534b3..90ad8faec 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -981,6 +981,7 @@ const char *EventNames[MAXEVENTS] = "EVENT_DAMAGEWALL", "EVENT_DAMAGEFLOOR", "EVENT_DAMAGECEILING", + "EVENT_DISPLAYROOMSCAMERATILE", #ifdef LUNATIC "EVENT_ANIMATEALLSPRITES", #endif diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 982e2608c..ab2e44a7a 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -376,12 +376,23 @@ int SetAnimation(int sectNum, int32_t *animPtr, int goalVal, int animVel) static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) { + int const playerNum = screenpeek; + int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERATILE, spriteNum, playerNum, 0); + vec3_t const camera = G_GetCameraPosition(spriteNum, smoothRatio); int const saveMirror = display_mirror; //if (waloff[wn] == 0) loadtile(wn); renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); + if (noDraw == 1) + return; +#ifdef DEBUGGINGAIDS + else if (EDUKE32_PREDICT_FALSE(noDraw != 0)) // event return values other than 0 and 1 are reserved + OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMSCAMERATILE return value must be 0 or 1, " + "other values are reserved.\n"); +#endif + yax_preparedrawrooms(); drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); yax_drawrooms(G_DoSpriteAnimations, SECT(spriteNum), 0, smoothRatio);