From 5806582805e8519928f237277a424868d86fef37 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 19 Aug 2012 13:00:08 +0000 Subject: [PATCH] Fake multi: draw the HUD weapons and status bar with the proper aspect. This uses the new rotatesprite bit introduced earlier. Also, allow the HUD-less screen size. git-svn-id: https://svn.eduke32.com/eduke32@2931 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 30 ++++++++++++++---------------- polymer/eduke32/source/player.c | 30 +++++++++--------------------- 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0e1b13082..38ba43c2e 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1174,7 +1174,7 @@ static void G_DrawStatusBar(int32_t snum) int32_t i, j, o, u; int32_t permbit = 0; - const int32_t ss = g_fakeMultiMode ? 4 : ud.screen_size; + const int32_t ss = g_fakeMultiMode ? min(ud.screen_size, 4) : ud.screen_size; const int32_t althud = g_fakeMultiMode ? 0 : ud.althud; const int32_t SBY = (200-tilesizy[BOTTOMSTATUSBAR]); @@ -1335,24 +1335,22 @@ static void G_DrawStatusBar(int32_t snum) else { // ORIGINAL MINI STATUS BAR + int32_t orient = 10+16+256 + (g_fakeMultiMode && snum==1)*(1<<29); - const int32_t ofs = (g_fakeMultiMode && snum==1) ? 160 : 0, ofssh=ofs<<16; - int32_t orient = 10+16+256 + (g_fakeMultiMode?1024:0); - - rotatesprite_fs(ofssh+sbarx(5),sbary(200-28),sb16,0,HEALTHBOX,0,21,orient); + rotatesprite_fs(sbarx(5),sbary(200-28),sb16,0,HEALTHBOX,0,21,orient); if (p->inven_icon) - rotatesprite_fs(ofssh+sbarx(69),sbary(200-30),sb16,0,INVENTORYBOX,0,21,orient); + rotatesprite_fs(sbarx(69),sbary(200-30),sb16,0,INVENTORYBOX,0,21,orient); // health if (sprite[p->i].pal == 1 && p->last_extra < 2) // frozen - G_DrawDigiNum(ofs+20,200-17,1,-16,orient); - else G_DrawDigiNum(ofs+20,200-17,p->last_extra,-16,orient); + G_DrawDigiNum(20,200-17,1,-16,orient); + else G_DrawDigiNum(20,200-17,p->last_extra,-16,orient); - rotatesprite_fs(ofssh+sbarx(37),sbary(200-28),sb16,0,AMMOBOX,0,21,orient); + rotatesprite_fs(sbarx(37),sbary(200-28),sb16,0,AMMOBOX,0,21,orient); if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; else i = p->curr_weapon; - G_DrawDigiNum(ofs+53,200-17,p->ammo_amount[i],-16,orient); + G_DrawDigiNum(53,200-17,p->ammo_amount[i],-16,orient); o = 158; permbit = 0; @@ -1362,25 +1360,25 @@ static void G_DrawStatusBar(int32_t snum) i = ((unsigned)p->inven_icon < 8) ? item_icons[p->inven_icon] : -1; if (i >= 0) - rotatesprite_fs(ofssh+sbarx(231-o),sbary(200-21),sb16,0,i,0,0, orient); + rotatesprite_fs(sbarx(231-o),sbary(200-21),sb16,0,i,0,0, orient); if (!g_fakeMultiMode) orient |= ROTATESPRITE_MAX; - minitext(ofs+292-30-o,190,"%",6, orient); + minitext(292-30-o,190,"%",6, orient); i = G_GetInvAmount(p); j = G_GetInvOn(p); - G_DrawInvNum(ofs+284-30-o,200-6,(uint8_t)i,0, orient&~16); + G_DrawInvNum(284-30-o,200-6,(uint8_t)i,0, orient&~16); if (j > 0) - minitext(ofs+288-30-o,180,"On",0, orient); + minitext(288-30-o,180,"On",0, orient); else if ((uint32_t)j != 0x80000000) - minitext(ofs+284-30-o,180,"Off",2, orient); + minitext(284-30-o,180,"Off",2, orient); if (p->inven_icon >= 6) - minitext(ofs+284-35-o,180,"Auto",2, orient); + minitext(284-35-o,180,"Auto",2, orient); } } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 41c603c98..cd9537654 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2022,11 +2022,10 @@ static inline int32_t weapsc(int32_t sc) static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) { - int32_t a = 0; + int32_t ang = 0; int32_t xoff = 192; - int32_t xadd = 0; - int32_t wx1=windowx1, wx2=windowx2; + int32_t wx[2] = { windowx1, windowx2 }; switch (g_currentweapon) { @@ -2043,36 +2042,25 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad break; } + // for G_DrawTileScaled, bit 4 means "flip x" if (orientation&4) - a = 1024; + ang = 1024; if (g_fakeMultiMode && ud.multimode==2) { // splitscreen HACK - xadd = (-80 + g_snum*160)*65536; - - if ((orientation&1024)==0) - { - x*=65536; - y*=65536; - orientation |= 1024; - } - - if (g_snum==0) - wx2 = (wx2+wx1)/2+1; - else - wx1 = (wx2+wx1)/2+1; - orientation |= 8; + orientation &= ~(1024|512|256|8); + wx[(g_snum==0)] = (wx[0]+wx[1])/2+1; } #ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(tilenum,p) >= 0) y += (224-weapsc(224)); #endif - rotatesprite(xadd + weapsc(x<<16) + ((xoff-weapsc(xoff))<<16), + rotatesprite(weapsc(x<<16) + ((xoff-weapsc(xoff))<<16), weapsc(y<<16) + ((200-weapsc(200))<<16), - weapsc(65536L),a,tilenum,shade,p,(2|orientation), - wx1,windowy1,wx2,windowy2); + weapsc(65536L),ang,tilenum,shade,p,(2|orientation), + wx[0],windowy1,wx[1],windowy2); } static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade,