From 60b876aa46ba23986c0f0485e080d03a1694d999 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 20 Aug 2012 21:29:54 +0000 Subject: [PATCH] splitscreen: handle crosshairs for above/below split and regard crosshairscale. git-svn-id: https://svn.eduke32.com/eduke32@2945 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/samples/splitscr.con | 23 ++++++++++++++++++++--- polymer/eduke32/source/player.c | 10 ++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/samples/splitscr.con b/polymer/eduke32/samples/splitscr.con index ce455d4bb..c2da59b4f 100644 --- a/polymer/eduke32/samples/splitscr.con +++ b/polymer/eduke32/samples/splitscr.con @@ -53,6 +53,7 @@ gamevar pangsin 0 0 // Sinus of player angle gamevar pinput 0 0 // Set to input, used in the PROCESSINPUT event gamevar pcrosshair 0 0 // Do you like crosshairs? Game options will tell. +gamevar crossscale 0 0 // crosshair scale gamevar pweapon 0 0 // Player weapon gamevar pfta 0 0 // Both used for quotes gamevar pftq 0 0 @@ -263,7 +264,7 @@ endevent // NOTE: status bar is displayed for both players (EDuke32 splitscreen hack) -// orientation bits for the crosshairs +// orientation bits for the crosshairs for left/right split define ORIENT 1032 // 26 // gametext args @@ -338,8 +339,24 @@ onevent EVENT_DISPLAYROOMS getuserdef[THISACTOR].crosshair pcrosshair ifvare pcrosshair 1 { - rotatesprite 80 100 32768 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim - rotatesprite 240 100 32768 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim + getuserdef .crosshairscale crossscale + shiftvarl crossscale 16, divvar crossscale 100 + + getuserdef .screen_size tmp + ifvarn tmp 0 + { + // left/right + + rotatesprite 80 100 crossscale 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim + rotatesprite 240 100 crossscale 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim + } + else + { + // above/below + setvar tmp 8 + rotatesprite 160 50 crossscale 0 CROSSHAIR 0 0 tmp 0 0 xdim ydim + rotatesprite 160 150 crossscale 0 CROSSHAIR 0 0 tmp 0 0 xdim ydim + } } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index de3bdcad0..e7c528d22 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2006,6 +2006,7 @@ static int32_t P_DisplayFist(int32_t gs,int32_t snum) fistpal = get_hud_pal(ps); + // XXX: this is outdated, doesn't handle above/below split. if (g_fakeMultiMode && ud.multimode==2) wx[(g_snum==0)] = (wx[0]+wx[1])/2+1; @@ -2118,6 +2119,10 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad G_DrawTileScaled(x,y,tilenum,shadef[slot],orientation,p); return; case 2: + { + const DukePlayer_t *const ps = g_player[screenpeek].ps; + const int32_t sc = scale(65536,ud.statusbarscale,100); + switch (g_currentweapon) { case PISTOL_WEAPON: @@ -2131,14 +2136,15 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad case HANDREMOTE_WEAPON: case HANDBOMB_WEAPON: case SHOTGUN_WEAPON: - rotatesprite_win(160<<16,(180+(g_player[screenpeek].ps->weapon_pos*g_player[screenpeek].ps->weapon_pos))<<16, - scale(65536,ud.statusbarscale,100),0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_currentweapon], + rotatesprite_win(160<<16,(180+(ps->weapon_pos*ps->weapon_pos))<<16, + sc,0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_currentweapon], 0,0,2); return; default: return; } } + } } static int32_t P_DisplayKnee(int32_t gs,int32_t snum)