From ce55b4a6fbc5b1503425437cd016915c83179e4f Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 24 Apr 2015 00:08:46 +0000 Subject: [PATCH] Add game-side def "globalgameflags" that takes a single value. Flag 1 disables hardcoded pinning of HUD weapons to the side of the screen in widescreen. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@5161 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/defs.c | 9 +++++++ polymer/eduke32/source/game.c | 7 +++++ polymer/eduke32/source/global.h | 6 +++++ polymer/eduke32/source/player.c | 44 ++++++++++++++++++++------------ 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 78e56b543..a1ea73f2f 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -102,6 +102,7 @@ enum scripttoken_t T_GLOBALFLAGS, T_RENAMEFILE, T_COPYTILE, + T_GLOBALGAMEFLAGS, }; static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; @@ -305,6 +306,7 @@ static int32_t defsparser(scriptfile *script) { "globalflags", T_GLOBALFLAGS }, { "renamefile", T_RENAMEFILE }, { "copytile", T_COPYTILE }, + { "globalgameflags", T_GLOBALGAMEFLAGS }, // dummy }; while (1) @@ -2438,6 +2440,13 @@ static int32_t defsparser(scriptfile *script) } break; + case T_GLOBALGAMEFLAGS: + { + int32_t dummy; + if (scriptfile_getnumber(script,&dummy)) break; + } + break; + case T_RENAMEFILE: { int32_t crcval = 0, filenum = -1; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 404914f7c..5a93a34eb 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -233,6 +233,7 @@ enum gametokens T_ID, T_DELAY, T_RENAMEFILE, + T_GLOBALGAMEFLAGS, }; @@ -9494,6 +9495,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload) { "cutscene", T_CUTSCENE }, { "animsounds", T_ANIMSOUNDS }, { "renamefile", T_RENAMEFILE }, + { "globalgameflags", T_GLOBALGAMEFLAGS }, }; static const tokenlist sound_musictokens[] = @@ -9809,6 +9811,11 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload) krename(crcval, filenum, newname); } break; + case T_GLOBALGAMEFLAGS: + { + if (scriptfile_getnumber(script,&duke3d_globalflags)) break; + } + break; case T_EOF: return(0); default: diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 92096ce6b..8d28c778e 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -55,6 +55,12 @@ G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; extern "C" { #endif +G_EXTERN int32_t duke3d_globalflags; + +enum { + DUKE3D_NO_WIDESCREEN_PINNING = 1<<0, +}; + G_EXTERN DukeStatus_t sbar; G_EXTERN actor_t actor[MAXSPRITES]; // g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 71731505b..799b76803 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2309,14 +2309,17 @@ void P_DisplayWeapon(void) weapon_xoffset -= sintable[(768 + ((*kb) << 7)) & 2047] >> 11; gun_pos += sintable[(768 + ((*kb) << 7)) & 2047] >> 11; + if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) + o |= 512; + if (*kb > 0 && *kb < 8) { G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, - RPGGUN + ((*kb) >> 1), gs, o | 512, pal, 0); + RPGGUN + ((*kb) >> 1), gs, o, pal, 0); } G_DrawWeaponTileWithID(cw, weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, RPGGUN, gs, - o | 512, pal, 0); + o, pal, 0); break; case SHOTGUN_WEAPON: @@ -2455,32 +2458,38 @@ void P_DisplayWeapon(void) l -= 3; G_DrawWeaponTileWithID(cw, (l-(p->look_ang>>1)), (looking_arc+244-gun_pos), FIRSTGUN+kb_frames[*kb>2 ? 0 : *kb], gs, 2, pal, 0); + + break; } - else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-17) - G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+230-gun_pos, FIRSTGUN+4, gs, o|512, pal, 0); + + if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) + o |= 512; + + if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-17) + G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+230-gun_pos, FIRSTGUN+4, gs, o, pal, 0); else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-12) { - G_DrawWeaponTileWithID(cw<<1, 244-((*kb)<<3)-(p->look_ang>>1), looking_arc+130-gun_pos+((*kb)<<4), FIRSTGUN+6, gs, o|512, pal, 0); - G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0); + G_DrawWeaponTileWithID(cw<<1, 244-((*kb)<<3)-(p->look_ang>>1), looking_arc+130-gun_pos+((*kb)<<4), FIRSTGUN+6, gs, o, pal, 0); + G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o, pal, 0); } else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-7) { - G_DrawWeaponTileWithID(cw<<1, 124+((*kb)<<1)-(p->look_ang>>1), looking_arc+430-gun_pos-((*kb)<<3), FIRSTGUN+6, gs, o|512, pal, 0); - G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0); + G_DrawWeaponTileWithID(cw<<1, 124+((*kb)<<1)-(p->look_ang>>1), looking_arc+430-gun_pos-((*kb)<<3), FIRSTGUN+6, gs, o, pal, 0); + G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o, pal, 0); } else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-4) { - G_DrawWeaponTileWithID(cw<<2, 184-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+8, gs, o|512, pal, 0); - G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+210-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0); + G_DrawWeaponTileWithID(cw<<2, 184-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+8, gs, o, pal, 0); + G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+210-gun_pos, FIRSTGUN+5, gs, o, pal, 0); } else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-2) { - G_DrawWeaponTileWithID(cw<<2, 164-(p->look_ang>>1), looking_arc+245-gun_pos, FIRSTGUN+8, gs, o|512, pal, 0); - G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0); + G_DrawWeaponTileWithID(cw<<2, 164-(p->look_ang>>1), looking_arc+245-gun_pos, FIRSTGUN+8, gs, o, pal, 0); + G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o, pal, 0); } else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)) - G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0); + G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+5, gs, o, pal, 0); break; @@ -2570,6 +2579,9 @@ void P_DisplayWeapon(void) if (VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek)) break; + if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) + o |= 512; + if ((*kb) < (PWEAPON(screenpeek, p->curr_weapon, TotalTime)+1) && (*kb) > 0) { static uint8_t cat_frames[] = { 0,0,1,1,2,2 }; @@ -2583,11 +2595,11 @@ void P_DisplayWeapon(void) looking_arc += rand()&3; } gun_pos -= 16; - G_DrawWeaponTileWithID(cw<<1, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE+2,-32,o|512,pal,0); - G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+235-gun_pos,FREEZE+3+cat_frames[*kb%6],-32,o|512,pal,0); + G_DrawWeaponTileWithID(cw<<1, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE+2,-32,o,pal,0); + G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+235-gun_pos,FREEZE+3+cat_frames[*kb%6],-32,o,pal,0); } else - G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE,gs,o|512,pal,0); + G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE,gs,o,pal,0); break; case GROW_WEAPON: