CON: Add EVENT_DISPLAYROOMSCAMERATILE

git-svn-id: https://svn.eduke32.com/eduke32@7313 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-01-22 17:56:34 +00:00
parent a91391fdec
commit 9b17be7f3e
4 changed files with 19 additions and 4 deletions

View file

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

View file

@ -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

View file

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

View file

@ -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);