CON: Add EVENT_DISPLAYROOMSCAMERA and EVENT_DISPLAYSTART.

EVENT_DISPLAYROOMSCAMERA functions exactly like EVENT_DISPLAYROOMS, including RETURN values, but for the ud.camerasprite >= 0 case.
EVENT_DISPLAYSTART is executed immediately after the screen background is cleared and drawn. Ensure its RETURN value is zero, because it is currently not being used.

WARNING: Consult the devs before using EVENT_DISPLAYSTART. Its position in the display code sequence is not finalized.

git-svn-id: https://svn.eduke32.com/eduke32@5047 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-08 07:58:24 +00:00
parent ef28cac919
commit f821434195
4 changed files with 29 additions and 12 deletions

View file

@ -108,6 +108,8 @@ enum GameEvent_t {
EVENT_DISPLAYCURSOR,
EVENT_DISPLAYLEVELSTATS,
EVENT_DISPLAYCAMERAOSD,
EVENT_DISPLAYROOMSCAMERA,
EVENT_DISPLAYSTART,
#ifdef LUNATIC
EVENT_ANIMATEALLSPRITES,
#endif

View file

@ -4450,6 +4450,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
pub = 0;
}
VM_OnEvent(EVENT_DISPLAYSTART, p->i, snum);
if (ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && getrendermode() != REND_CLASSIC))
return;
@ -4459,7 +4461,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
setaspect_new();
}
if (ud.pause_on || g_player[snum].ps->on_crane > -1)
if (ud.pause_on || p->on_crane > -1)
smoothratio = 65536;
else
smoothratio = calc_smoothratio(totalclock, ototalclock);
@ -4484,18 +4486,28 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
CAMERA(ang) = actor[ud.camerasprite].tempang +
mulscale16(((s->ang+1024-actor[ud.camerasprite].tempang)&2047)-1024, smoothratio);
dont_draw = VM_OnEvent(EVENT_DISPLAYROOMSCAMERA, p->i, snum);
if (dont_draw != 1) // event return values other than 0 and 1 are reserved
{
if (EDUKE32_PREDICT_FALSE(dont_draw != 0))
OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMSCAMERA return value must be 0 or 1, "
"other values are reserved.\n");
#ifdef LEGACY_ROR
G_SE40(smoothratio);
G_SE40(smoothratio);
#endif
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, CAMERA(ang), smoothratio);
if (getrendermode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, CAMERA(ang), smoothratio);
#endif
yax_preparedrawrooms();
drawrooms(s->x,s->y,s->z-(4<<8),CAMERA(ang),s->yvel,s->sectnum);
yax_drawrooms(G_DoSpriteAnimations, s->sectnum, 0, smoothratio);
G_DoSpriteAnimations(s->x,s->y,CAMERA(ang),smoothratio);
drawmasks();
yax_preparedrawrooms();
drawrooms(s->x,s->y,s->z-(4<<8),CAMERA(ang),s->yvel,s->sectnum);
yax_drawrooms(G_DoSpriteAnimations, s->sectnum, 0, smoothratio);
G_DoSpriteAnimations(s->x,s->y,CAMERA(ang),smoothratio);
drawmasks();
}
}
else
{
@ -4737,10 +4749,9 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
break;
}
dont_draw = 0;
// NOTE: might be rendering off-screen here, so CON commands that draw stuff
// like showview must cope with that situation or bail out!
dont_draw = VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek);
dont_draw = VM_OnEvent(EVENT_DISPLAYROOMS, p->i, snum);
CAMERA(horiz) = clamp(CAMERA(horiz), HORIZ_MIN, HORIZ_MAX);

View file

@ -673,6 +673,8 @@ const char *EventNames[MAXEVENTS] =
"EVENT_DISPLAYCURSOR",
"EVENT_DISPLAYLEVELSTATS",
"EVENT_DISPLAYCAMERAOSD",
"EVENT_DISPLAYROOMSCAMERA",
"EVENT_DISPLAYSTART",
#ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES",
#endif

View file

@ -180,11 +180,13 @@ EVENT = {
EVENT_DISPLAYCURSOR = 100,
EVENT_DISPLAYLEVELSTATS = 101,
EVENT_DISPLAYCAMERAOSD = 102,
EVENT_DISPLAYROOMSCAMERA = 103,
EVENT_DISPLAYSTART = 104,
-- EVENT_ANIMATEALLSPRITES = previous+1, -- internal
-- KEEPINSYNC with MAXEVENTS below
}
MAXEVENTS = 103 -- KEEPINSYNC with above EVENT_* list
MAXEVENTS = 105 -- KEEPINSYNC with above EVENT_* list
-- NOTE: negated values are not exported to the ffi.C namespace or CON.
-- See TWEAK_SFLAG below.