From e14d92a2af90cebf0d701a76b07d365c2ca62b90 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 23 Jul 2018 02:56:05 +0000 Subject: [PATCH] Clean up variables in overhead map player sprite draw code. git-svn-id: https://svn.eduke32.com/eduke32@6953 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/screens.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 46a60ba79..b5a8d9397 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -577,9 +577,12 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 { if (ud.scrollmode && p == screenpeek) continue; - ox = sprite[g_player[p].ps->i].x-cposx; - oy = sprite[g_player[p].ps->i].y-cposy; - daang = (sprite[g_player[p].ps->i].ang-cang)&2047; + DukePlayer_t const * const pPlayer = g_player[p].ps; + uspritetype const * const pSprite = (uspritetype const *)&sprite[pPlayer->i]; + + ox = pSprite->x - cposx; + oy = pSprite->y - cposy; + daang = (pSprite->ang - cang) & 2047; if (p == screenpeek) { ox = 0; @@ -591,24 +594,24 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 if (p == screenpeek || GTFLAGS(GAMETYPE_OTHERPLAYERSINMAP)) { - if (sprite[g_player[p].ps->i].xvel > 16 && g_player[p].ps->on_ground) + if (pSprite->xvel > 16 && pPlayer->on_ground) i = APLAYERTOP+((totalclock>>4)&3); else i = APLAYERTOP; - i = VM_OnEventWithReturn(EVENT_DISPLAYOVERHEADMAPPLAYER, g_player[p].ps->i, p, i); + i = VM_OnEventWithReturn(EVENT_DISPLAYOVERHEADMAPPLAYER, pPlayer->i, p, i); if (i < 0) continue; - j = klabs(g_player[p].ps->truefz-g_player[p].ps->pos.z)>>8; - j = mulscale16(czoom*(sprite[g_player[p].ps->i].yrepeat+j), yxaspect); + j = klabs(pPlayer->truefz - pPlayer->pos.z) >> 8; + j = mulscale16(czoom * (pSprite->yrepeat + j), yxaspect); if (j < 22000) j = 22000; - else if (j >(65536<<1)) j = (65536<<1); + else if (j > (65536<<1)) j = (65536<<1); - rotatesprite_win((x1<<4)+(xdim<<15), (y1<<4)+(ydim<<15), j, daang, i, sprite[g_player[p].ps->i].shade, - (g_player[p].ps->cursectnum > -1) ? sector[g_player[p].ps->cursectnum].floorpal : 0, 0); + rotatesprite_win((x1<<4)+(xdim<<15), (y1<<4)+(ydim<<15), j, daang, i, pSprite->shade, + (pPlayer->cursectnum > -1) ? sector[pPlayer->cursectnum].floorpal : 0, 0); } } }