a.m32: Implement a Polymer "head light" emanating from your position in 3D mode.

Toggled with Ctrl+Shift+[KP-]. Variable 'headlight_range' controls its range.
For the implementation, a new event EVENT_PREDRAW3DSCREEN was added.

git-svn-id: https://svn.eduke32.com/eduke32@3648 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-05 17:53:31 +00:00
parent 53b01f57c6
commit f1f84beeda
4 changed files with 60 additions and 0 deletions

View file

@ -93,6 +93,7 @@ enum GameEvent_t {
EVENT_PREKEYS3D, EVENT_PREKEYS3D,
EVENT_LINKTAGS, EVENT_LINKTAGS,
EVENT_KEYPRESS, EVENT_KEYPRESS,
EVENT_PREDRAW3DSCREEN,
MAXEVENTS MAXEVENTS
}; };

View file

@ -471,6 +471,8 @@ void M32_ResetFakeRORTiles(void)
void M32_DrawRoomsAndMasks(void) void M32_DrawRoomsAndMasks(void)
{ {
VM_OnEvent(EVENT_PREDRAW3DSCREEN, -1);
yax_preparedrawrooms(); yax_preparedrawrooms();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
yax_drawrooms(ExtAnalyzeSprites, cursectnum, 0, 0); yax_drawrooms(ExtAnalyzeSprites, cursectnum, 0, 0);

View file

@ -40,6 +40,10 @@ gamevar showrespawn_always 0 0
gamevar move_by_one 0 0 gamevar move_by_one 0 0
// Polymer "head" light
gamevar headlight_enabled 0 0
gamevar headlight_range 4000 0
// see end of file for more user settings and examples // see end of file for more user settings and examples
////////// END USER SETTINGS ////////// ////////// END USER SETTINGS //////////
@ -424,6 +428,24 @@ defstate fiddlewithlights
} }
} }
} }
else
{
// not aiming at sprite
ifeitherctrl ifeithershift ifhitkey KEY_gMINUS
{
ife headlight_enabled 0
{
set headlight_enabled 1
quote "head light enabled"
}
else
{
set headlight_enabled 0
quote "head light disabled"
}
}
}
ends ends
defstate do_move_by_one defstate do_move_by_one
@ -1119,6 +1141,40 @@ onevent EVENT_ANALYZESPRITES
state tduplin state tduplin
endevent endevent
defstate update_headlight
var li hrz
set li 0
ifvare headlight_enabled 0
break
ifvarn light[li].active 1
break
set light[li].x posx
set light[li].y posy
set light[li].z posz
set light[li].sector cursectnum
set hrz horiz
set light[li].horiz hrz
set light[li].angle ang
set light[li].range headlight_range
set light[li].radius 256
set light[li].faderadius 128
set light[li].r 255
set light[li].g 255
set light[li].b 255
set light[li].priority 0
set light[li].tilenum 0
ends
onevent EVENT_PREDRAW3DSCREEN
state update_headlight
endevent
onevent EVENT_KEYS3D onevent EVENT_KEYS3D
var l m var l m

View file

@ -3514,6 +3514,7 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("EVENT_PREKEYS3D", EVENT_PREKEYS3D, LABEL_EVENT); C_AddDefinition("EVENT_PREKEYS3D", EVENT_PREKEYS3D, LABEL_EVENT);
C_AddDefinition("EVENT_LINKTAGS", EVENT_LINKTAGS, LABEL_EVENT); C_AddDefinition("EVENT_LINKTAGS", EVENT_LINKTAGS, LABEL_EVENT);
C_AddDefinition("EVENT_KEYPRESS", EVENT_KEYPRESS, LABEL_EVENT); C_AddDefinition("EVENT_KEYPRESS", EVENT_KEYPRESS, LABEL_EVENT);
C_AddDefinition("EVENT_PREDRAW3DSCREEN", EVENT_PREDRAW3DSCREEN, LABEL_EVENT);
C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE); C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE);
C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE); C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE);