feature: option to show voxels instead of sprites for showing weapon (#233)

# Conflicts:
#	source/blood/src/controls.cpp
#	source/blood/src/menu.cpp
#	source/blood/src/osdcmd.cpp
This commit is contained in:
CommonLoon102 2019-10-27 09:17:46 +00:00 committed by Christoph Oelckers
parent c0d5ca8ab8
commit 441bd25ca5
3 changed files with 51 additions and 32 deletions

View file

@ -266,7 +266,7 @@ void ctrlGetInput(void)
if (BUTTON(gamefunc_Show_Opponents_Weapon)) if (BUTTON(gamefunc_Show_Opponents_Weapon))
{ {
CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon); CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon);
cl_showweapon = !cl_showweapon; cl_showweapon = (cl_showweapon + 1) & 3;
} }
if (BUTTON(gamefunc_Jump)) if (BUTTON(gamefunc_Jump))

View file

@ -59,7 +59,7 @@ void SetCDVol(CGameMenuItemSlider *);
void SetDoppler(CGameMenuItemZBool *); void SetDoppler(CGameMenuItemZBool *);
void SetCrosshair(CGameMenuItemZBool *); void SetCrosshair(CGameMenuItemZBool *);
void SetCenterHoriz(CGameMenuItemZBool *); void SetCenterHoriz(CGameMenuItemZBool *);
void SetShowWeapons(CGameMenuItemZBool *); void SetShowWeapons(CGameMenuItemZCycle *);
void SetSlopeTilting(CGameMenuItemZBool *); void SetSlopeTilting(CGameMenuItemZBool *);
void SetViewBobbing(CGameMenuItemZBool *); void SetViewBobbing(CGameMenuItemZBool *);
void SetViewSwaying(CGameMenuItemZBool *); void SetViewSwaying(CGameMenuItemZBool *);
@ -146,6 +146,12 @@ const char *zDiffStrings[] =
"EXTRA CRISPY", "EXTRA CRISPY",
}; };
const char *pzShowWeaponStrings[] = {
"OFF",
"SPRITE",
"VOXEL"
};
char zUserMapName[16]; char zUserMapName[16];
const char *zEpisodeNames[6]; const char *zEpisodeNames[6];
const char *zLevelNames[6][16]; const char *zLevelNames[6][16];
@ -229,7 +235,7 @@ CGameMenuItemSlider sliderSound("SOUND:", 3, 66, 80, 180, snd_fxvolume, 0, 256,
//CGameMenuItemSlider sliderCDAudio("CD AUDIO:", 3, 66, 90, 180, CDVolume, 0, 256, 48, SetCDVol, -1, -1); //CGameMenuItemSlider sliderCDAudio("CD AUDIO:", 3, 66, 90, 180, CDVolume, 0, 256, 48, SetCDVol, -1, -1);
CGameMenuItemZBool bool3DAudio("3D AUDIO:", 3, 66, 100, 180, snd_doppler, SetDoppler, NULL, NULL); CGameMenuItemZBool bool3DAudio("3D AUDIO:", 3, 66, 100, 180, snd_doppler, SetDoppler, NULL, NULL);
CGameMenuItemZBool boolCrosshair("CROSSHAIR:", 3, 66, 110, 180, cl_crosshair, SetCrosshair, NULL, NULL); CGameMenuItemZBool boolCrosshair("CROSSHAIR:", 3, 66, 110, 180, cl_crosshair, SetCrosshair, NULL, NULL);
CGameMenuItemZBool boolShowWeapons("SHOW WEAPONS:", 3, 66, 120, 180, cl_showweapon, SetShowWeapons, NULL, NULL); CGameMenuItemZCycle itemCycleShowWeapons("SHOW WEAPONS:", 3, 66, 120, 180, 0, SetShowWeapons, pzShowWeaponStrings, ARRAY_SSIZE(pzShowWeaponStrings), 0);
CGameMenuItemZBool boolSlopeTilting("SLOPE TILTING:", 3, 66, 130, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL); CGameMenuItemZBool boolSlopeTilting("SLOPE TILTING:", 3, 66, 130, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL);
CGameMenuItemZBool boolViewBobbing("VIEW BOBBING:", 3, 66, 140, 180, cl_viewvbob, SetViewBobbing, NULL, NULL); CGameMenuItemZBool boolViewBobbing("VIEW BOBBING:", 3, 66, 140, 180, cl_viewvbob, SetViewBobbing, NULL, NULL);
CGameMenuItemZBool boolViewSwaying("VIEW SWAYING:", 3, 66, 150, 180, cl_viewhbob, SetViewSwaying, NULL, NULL); CGameMenuItemZBool boolViewSwaying("VIEW SWAYING:", 3, 66, 150, 180, cl_viewhbob, SetViewSwaying, NULL, NULL);
@ -404,7 +410,7 @@ CGameMenuItemTitle itemOptionsGameTitle("GAME SETUP", 1, 160, 20, 2038);
CGameMenuItemZBool itemOptionsGameBoolWeaponsV10X("V1.0x WEAPONS BALANCE:", 3, 66, 130, 180, gWeaponsV10x, SetWeaponsV10X, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolWeaponsV10X("V1.0x WEAPONS BALANCE:", 3, 66, 130, 180, gWeaponsV10x, SetWeaponsV10X, NULL, NULL);
/////////////////// ///////////////////
CGameMenuItemZBool itemOptionsGameBoolShowWeapons("SHOW WEAPONS:", 3, 66, 70, 180, cl_showweapon, SetShowWeapons, NULL, NULL); CGameMenuItemZCycle itemOptionsGameShowWeapons("SHOW WEAPONS:", 3, 66, 70, 180, 0, SetShowWeapons, pzShowWeaponStrings, ARRAY_SSIZE(pzShowWeaponStrings), 0);
CGameMenuItemZBool itemOptionsGameBoolSlopeTilting("SLOPE TILTING:", 3, 66, 80, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolSlopeTilting("SLOPE TILTING:", 3, 66, 80, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL);
CGameMenuItemZBool itemOptionsGameBoolViewBobbing("VIEW BOBBING:", 3, 66, 90, 180, cl_viewvbob, SetViewBobbing, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolViewBobbing("VIEW BOBBING:", 3, 66, 90, 180, cl_viewvbob, SetViewBobbing, NULL, NULL);
CGameMenuItemZBool itemOptionsGameBoolViewSwaying("VIEW SWAYING:", 3, 66, 100, 180, cl_viewhbob, SetViewSwaying, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolViewSwaying("VIEW SWAYING:", 3, 66, 100, 180, cl_viewhbob, SetViewSwaying, NULL, NULL);
@ -760,7 +766,7 @@ void SetupOptionsOldMenu(void)
sliderSound.nValue = ClipRange(snd_fxvolume, sliderSound.nRangeLow, sliderSound.nRangeHigh); sliderSound.nValue = ClipRange(snd_fxvolume, sliderSound.nRangeLow, sliderSound.nRangeHigh);
bool3DAudio.at20 = snd_doppler; bool3DAudio.at20 = snd_doppler;
boolCrosshair.at20 = cl_crosshair; boolCrosshair.at20 = cl_crosshair;
boolShowWeapons.at20 = cl_showweapon; itemCycleShowWeapons.m_nFocus = cl_showweapon;
boolSlopeTilting.at20 = cl_slopetilting; boolSlopeTilting.at20 = cl_slopetilting;
boolViewBobbing.at20 = cl_viewvbob; boolViewBobbing.at20 = cl_viewvbob;
boolViewSwaying.at20 = cl_viewhbob; boolViewSwaying.at20 = cl_viewhbob;
@ -774,7 +780,7 @@ void SetupOptionsOldMenu(void)
//menuOptionsOld.Add(&sliderCDAudio, false); //menuOptionsOld.Add(&sliderCDAudio, false);
menuOptionsOld.Add(&bool3DAudio, false); menuOptionsOld.Add(&bool3DAudio, false);
menuOptionsOld.Add(&boolCrosshair, false); menuOptionsOld.Add(&boolCrosshair, false);
menuOptionsOld.Add(&boolShowWeapons, false); menuOptionsOld.Add(&itemCycleShowWeapons, false);
menuOptionsOld.Add(&boolSlopeTilting, false); menuOptionsOld.Add(&boolSlopeTilting, false);
menuOptionsOld.Add(&boolViewBobbing, false); menuOptionsOld.Add(&boolViewBobbing, false);
menuOptionsOld.Add(&boolViewSwaying, false); menuOptionsOld.Add(&boolViewSwaying, false);
@ -1111,7 +1117,7 @@ void SetupOptionsMenu(void)
menuOptions.Add(&itemBloodQAV, false); menuOptions.Add(&itemBloodQAV, false);
menuOptionsGame.Add(&itemOptionsGameTitle, false); menuOptionsGame.Add(&itemOptionsGameTitle, false);
menuOptionsGame.Add(&itemOptionsGameBoolShowWeapons, true); menuOptionsGame.Add(&itemOptionsGameShowWeapons, true);
menuOptionsGame.Add(&itemOptionsGameBoolSlopeTilting, false); menuOptionsGame.Add(&itemOptionsGameBoolSlopeTilting, false);
menuOptionsGame.Add(&itemOptionsGameBoolViewBobbing, false); menuOptionsGame.Add(&itemOptionsGameBoolViewBobbing, false);
menuOptionsGame.Add(&itemOptionsGameBoolViewSwaying, false); menuOptionsGame.Add(&itemOptionsGameBoolViewSwaying, false);
@ -1126,7 +1132,7 @@ void SetupOptionsMenu(void)
//menuOptionsGame.Add(&itemOptionsGameChainParentalLock, false); //menuOptionsGame.Add(&itemOptionsGameChainParentalLock, false);
menuOptionsGame.Add(&itemBloodQAV, false); menuOptionsGame.Add(&itemBloodQAV, false);
itemOptionsGameBoolShowWeapons.at20 = cl_showweapon; itemOptionsGameShowWeapons.m_nFocus = cl_showweapon;
itemOptionsGameBoolSlopeTilting.at20 = cl_slopetilting; itemOptionsGameBoolSlopeTilting.at20 = cl_slopetilting;
itemOptionsGameBoolViewBobbing.at20 = cl_viewvbob; itemOptionsGameBoolViewBobbing.at20 = cl_viewvbob;
itemOptionsGameBoolViewSwaying.at20 = cl_viewhbob; itemOptionsGameBoolViewSwaying.at20 = cl_viewhbob;
@ -1401,9 +1407,9 @@ void SetWeaponsV10X(CGameMenuItemZBool* pItem)
} }
//// ////
void SetShowWeapons(CGameMenuItemZBool *pItem) void SetShowWeapons(CGameMenuItemZCycle *pItem)
{ {
cl_showweapon = pItem->at20; cl_showweapon = pItem->m_nFocus;
} }
void SetSlopeTilting(CGameMenuItemZBool *pItem) void SetSlopeTilting(CGameMenuItemZBool *pItem)

View file

@ -1151,25 +1151,24 @@ AMMOICON gAmmoIcons[] = {
struct WEAPONICON { struct WEAPONICON {
short nTile; short nTile;
char xRepeat; char zOffset;
char yRepeat;
}; };
WEAPONICON gWeaponIcon[] = { WEAPONICON gWeaponIcon[] = {
{ -1, 0, 0 }, { -1, 0 },
{ -1, 0, 0 }, { -1, 0 }, // 1: pitchfork
{ 524, 32, 32 }, { 524, 6 }, // 2: flare gun
{ 559, 32, 32 }, { 559, 6 }, // 3: shotgun
{ 558, 32, 32 }, { 558, 8 }, // 4: tommy gun
{ 526, 32, 32 }, { 526, 6 }, // 5: napalm launcher
{ 589, 32, 32 }, { 589, 11 }, // 6: dynamite
{ 618, 32, 32 }, { 618, 11 }, // 7: spray can
{ 539, 32, 32 }, { 539, 6 }, // 8: tesla gun
{ 800, 32, 32 }, { 800, 0 }, // 9: life leech
{ 525, 32, 32 }, { 525, 11 }, // 10: voodoo doll
{ 811, 32, 32 }, { 811, 11 }, // 11: proxy bomb
{ 810, 32, 32 }, { 810, 11 }, // 12: remote bomb
{ -1, 0, 0 }, { -1, 0 },
}; };
int dword_14C508; int dword_14C508;
@ -2156,17 +2155,31 @@ uspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
{ {
dassert(pTSprite->type >= kDudePlayer1 && pTSprite->type <= kDudePlayer8); dassert(pTSprite->type >= kDudePlayer1 && pTSprite->type <= kDudePlayer8);
PLAYER *pPlayer = &gPlayer[pTSprite->type-kDudePlayer1]; PLAYER *pPlayer = &gPlayer[pTSprite->type-kDudePlayer1];
if (gWeaponIcon[pPlayer->curWeapon].nTile < 0) break; WEAPONICON weaponIcon = gWeaponIcon[pPlayer->curWeapon];
const int nTile = weaponIcon.nTile;
if (nTile < 0) break;
uspritetype *pNSprite = viewInsertTSprite(pTSprite->sectnum, 32767, pTSprite); uspritetype *pNSprite = viewInsertTSprite(pTSprite->sectnum, 32767, pTSprite);
int top, bottom;
GetSpriteExtents((spritetype *)pTSprite, &top, &bottom);
pNSprite->x = pTSprite->x; pNSprite->x = pTSprite->x;
pNSprite->y = pTSprite->y; pNSprite->y = pTSprite->y;
pNSprite->z = pTSprite->z-(32<<8); pNSprite->z = pTSprite->z-(32<<8);
pNSprite->picnum = gWeaponIcon[pPlayer->curWeapon].nTile; pNSprite->picnum = nTile;
pNSprite->shade = pTSprite->shade; pNSprite->shade = pTSprite->shade;
pNSprite->xrepeat = gWeaponIcon[pPlayer->curWeapon].xRepeat; pNSprite->xrepeat = 32;
pNSprite->yrepeat = gWeaponIcon[pPlayer->curWeapon].yRepeat; pNSprite->yrepeat = 32;
const int nVoxel = voxelIndex[nTile];
if (gShowWeapon == 2 && usevoxels && gDetail >= 4 && videoGetRenderMode() != REND_POLYMER && nVoxel != -1)
{
pNSprite->cstat |= 48;
pNSprite->cstat &= ~8;
pNSprite->picnum = nVoxel;
pNSprite->z -= weaponIcon.zOffset<<8;
const int lifeLeech = 9;
if (pPlayer->curWeapon == lifeLeech)
{
pNSprite->x -= mulscale30(128, Cos(pNSprite->ang));
pNSprite->y -= mulscale30(128, Sin(pNSprite->ang));
}
}
break; break;
} }
} }