mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
1. Fix translucency in the mouse cursor.
2. In "EVENT_DISPLAYCROSSHAIR" and "EVENT_DISPLAYCURSOR", make "userdef[].return" 1 and 2 return the coordinates, and 3 the alpha ("EVENT_DISPLAYCURSOR" only). 3. New event "EVENT_DISPLAYPOINTER" Similar to "EVENT_DISPLAYCURSOR", it is used to display the pointer that controls the aiming in Wii. "RETURN" / "userdef[].return" work in the same way as "EVENT_DISPLAYCURSOR". Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6714 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
920ec3f6a2
commit
293491644f
5 changed files with 43 additions and 16 deletions
|
@ -148,6 +148,7 @@ enum GameEvent_t {
|
|||
EVENT_MENUSHADESELECTED,
|
||||
EVENT_PLAYLEVELMUSICSLOT,
|
||||
EVENT_CONTINUELEVELMUSICSLOT,
|
||||
EVENT_DISPLAYPOINTER,
|
||||
#ifdef LUNATIC
|
||||
EVENT_ANIMATEALLSPRITES,
|
||||
#endif
|
||||
|
|
|
@ -764,6 +764,7 @@ const char *EventNames[MAXEVENTS] =
|
|||
"EVENT_MENUSHADESELECTED",
|
||||
"EVENT_PLAYLEVELMUSICSLOT",
|
||||
"EVENT_CONTINUELEVELMUSICSLOT",
|
||||
"EVENT_DISPLAYPOINTER",
|
||||
#ifdef LUNATIC
|
||||
"EVENT_ANIMATEALLSPRITES",
|
||||
#endif
|
||||
|
|
|
@ -6765,6 +6765,12 @@ void M_DisplayMenus(void)
|
|||
// Display the mouse cursor, except on touch devices.
|
||||
if (MOUSEACTIVECONDITION)
|
||||
{
|
||||
if (VM_HaveEvent(EVENT_DISPLAYCURSOR))
|
||||
{
|
||||
ud.returnvar[0] = m_mousepos.x;
|
||||
ud.returnvar[1] = m_mousepos.y;
|
||||
ud.returnvar[2] = CURSORALPHA;
|
||||
}
|
||||
int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYCURSOR, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR);
|
||||
|
||||
if ((unsigned) a < MAXTILES)
|
||||
|
@ -6780,7 +6786,7 @@ void M_DisplayMenus(void)
|
|||
setaspect(viewingrange, 65536);
|
||||
cursorpos.x = scale(cursorpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15);
|
||||
cursorpos.y = scale(cursorpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
|
||||
z = scale(65536, ydim << 2, xdim * 3);
|
||||
z = scale(z, ydim << 2, xdim * 3);
|
||||
p = 0;
|
||||
o |= 1024;
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint;
|
|||
// use 16 anyway :P
|
||||
# define MOUSEUSEALPHA (getrendermode() != REND_CLASSIC || numalphatabs >= 15)
|
||||
# define MOUSEALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255) : 0)
|
||||
# define CURSORALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*2 + (255/3), (255/3), 255) : 0)
|
||||
# define CURSORALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*2 + (255/3), (255/3), 255) : 255/3)
|
||||
# define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
|
||||
# define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition))
|
||||
# define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition))
|
||||
|
|
|
@ -1156,25 +1156,21 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1)
|
||||
{
|
||||
int32_t a = VM_OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek);
|
||||
|
||||
ud.returnvar[0] = (160<<16) - (g_player[myconnectindex].ps->look_ang<<15);
|
||||
ud.returnvar[1] = 100<<16;
|
||||
int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR);
|
||||
if ((unsigned) a < MAXTILES)
|
||||
{
|
||||
if (a == 0)
|
||||
a = CROSSHAIR;
|
||||
|
||||
vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 };
|
||||
|
||||
vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] };
|
||||
uint8_t crosshair_pal = CROSSHAIR_PAL;
|
||||
uint32_t crosshair_o = 1|2;
|
||||
uint32_t crosshair_scale = divscale16(ud.crosshairscale, 100);
|
||||
|
||||
auto const oyxaspect = yxaspect;
|
||||
|
||||
if (KXDWN)
|
||||
{
|
||||
crosshairpos.x = scale(crosshairpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15);
|
||||
// crosshairpos.y = scale(crosshairpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15); // no-op for constant centering
|
||||
crosshairpos.y = scale(crosshairpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
|
||||
crosshair_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1;
|
||||
crosshair_pal = 0;
|
||||
crosshair_o |= 1024;
|
||||
|
@ -1183,19 +1179,42 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o);
|
||||
|
||||
if (KXDWN)
|
||||
setaspect(viewingrange, oyxaspect);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && readmouseabsxy(&crosshairpos, &mouseabs))
|
||||
// like the mouse cursor, the pointer doesn't use the crosshair enabled / scale options
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.camerasprite == -1 &&
|
||||
(g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && readmouseabsxy((vec2_t *)&ud.returnvar[0], &mouseabs))
|
||||
{
|
||||
int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYPOINTER, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR);
|
||||
if ((unsigned) a < MAXTILES)
|
||||
{
|
||||
vec2_t pointerpos = { ud.returnvar[0], ud.returnvar[1] };
|
||||
uint8_t pointer_pal = CROSSHAIR_PAL;
|
||||
uint32_t pointer_o = 1|2;
|
||||
uint32_t pointer_scale = 65536;
|
||||
|
||||
auto const oyxaspect = yxaspect;
|
||||
if (KXDWN)
|
||||
{
|
||||
crosshairpos.x = scale(crosshairpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15);
|
||||
crosshairpos.y = scale(crosshairpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
|
||||
rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o);
|
||||
pointerpos.x = scale(pointerpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15);
|
||||
pointerpos.y = scale(pointerpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
|
||||
pointer_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1;
|
||||
pointer_pal = 0;
|
||||
pointer_o |= 1024;
|
||||
setaspect(viewingrange, 65536);
|
||||
}
|
||||
#endif
|
||||
|
||||
rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o);
|
||||
|
||||
if (KXDWN)
|
||||
setaspect(viewingrange, oyxaspect);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue