Merge branch 'master' into powerslave

This commit is contained in:
Christoph Oelckers 2019-12-02 21:14:08 +01:00
commit 51083f6d51
11 changed files with 149 additions and 69 deletions

View file

@ -167,6 +167,12 @@ void WeaponCheat(PLAYERp pp, const char *)
p = &Player[pnum];
u = User[p->PlayerSprite];
if (!TEST(p->Flags, PF_TWO_UZI))
{
SET(p->Flags, PF_TWO_UZI);
SET(p->Flags, PF_PICKED_UP_AN_UZI);
}
// ALL WEAPONS
if (!SW_SHAREWARE)
p->WpnFlags = 0xFFFFFFFF;
@ -248,13 +254,6 @@ void ItemCheat(PLAYERp pp, const char *cheat_string)
p = &Player[pnum];
memset(p->HasKey, TRUE, sizeof(p->HasKey));
if (p->Wpn[WPN_UZI] && p->CurWpn == p->Wpn[WPN_UZI])
{
SET(p->Flags, PF_TWO_UZI);
SET(p->Flags, PF_PICKED_UP_AN_UZI);
InitWeaponUzi(p);
}
p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5;
p->WpnRocketNuke = 1;

View file

@ -765,7 +765,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
//#define DART_REPEAT 6
//#define DART_PIC 2233
if (useDarts)
if (gs.Darts)
if (tu->ID == 1793 || tsp->picnum == 1793)
{
tsp->picnum = 2519;
@ -777,7 +777,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
#define DART_REPEAT 16
if (tu->ID == STAR1)
{
if (useDarts)
if (gs.Darts)
{
tsp->picnum = DART_PIC;
tsp->ang = NORM_ANGLE(tsp->ang - 512 - 24);
@ -841,7 +841,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
}
}
if (useDarts)
if (gs.Darts)
if (tsp->statnum == STAT_STAR_QUEUE)
{
tsp->picnum = DART_PIC;

View file

@ -208,6 +208,8 @@ const GAME_SET gs_defaults =
0, // Color
TRUE, // nuke
"Track??", // waveform track name
FALSE,
TRUE,
};
GAME_SET gs;
@ -2657,9 +2659,11 @@ void Control()
void _Assert(const char *expr, const char *strFile, unsigned uLine)
{
sprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine);
MONO_PRINT(ds);
buildprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine);
debug_break();
TerminateGame();
#if 1 //def RENDERTYPEWIN
wm_msgbox(apptitle, "%s", ds);
#else
@ -3012,7 +3016,7 @@ Nuke -> 0=Off 1=On
commit -map grenade -autonet 0,0,1,1,1,0,3,2,1,1 -name frank
#endif
char isShareware = FALSE, useDarts = FALSE;
char isShareware = FALSE;
int DetectShareware(void)
{
@ -3334,10 +3338,46 @@ void ConKey(void)
#endif
}
void FunctionKeys(PLAYERp pp)
char WangBangMacro[10][64];
SWBOOL DoQuickSave(short save_num)
{
PauseAction();
if (SaveGame(save_num) != -1)
{
QuickLoadNum = save_num;
LastSaveNum = -1;
return FALSE;
}
return TRUE;
}
SWBOOL DoQuickLoad()
{
KB_ClearKeysDown();
PauseAction();
ReloadPrompt = FALSE;
if (LoadGame(QuickLoadNum) == -1)
{
return FALSE;
}
ready2send = 1;
LastSaveNum = -1;
return TRUE;
}
void
FunctionKeys(PLAYERp pp)
{
extern SWBOOL GamePaused;
extern short QuickLoadNum;
static int rts_delay = 0;
int fn_key = 0;
@ -3431,16 +3471,25 @@ void FunctionKeys(PLAYERp pp)
}
}
// F6 option menu
// F6 quick save
if (inputState.GetKeyStatus(KEYSC_F6))
{
extern SWBOOL QuickSaveMode;
inputState.ClearKeyStatus(KEYSC_F6);
if (!TEST(pp->Flags, PF_DEAD))
{
inputState.SetKeyStatus(sc_Escape);
ControlPanelType = ct_savemenu;
QuickSaveMode = TRUE;
if (QuickLoadNum < 0)
{
KEY_PRESSED(KEYSC_ESC) = 1;
ControlPanelType = ct_savemenu;
}
else
{
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
DoQuickSave(QuickLoadNum);
ResumeAction();
}
}
}
@ -3453,17 +3502,16 @@ void FunctionKeys(PLAYERp pp)
{
if (QuickLoadNum < 0)
{
PutStringInfoLine(pp, "Last saved game not found.");
KEY_PRESSED(KEYSC_ESC) = 1;
ControlPanelType = ct_loadmenu;
}
else
{
inputState.ClearKeysDown();
inputState.SetKeyStatus(sc_Escape);
ControlPanelType = ct_quickloadmenu;
DoQuickLoad();
ResumeAction();
}
}
}
}
@ -3533,7 +3581,6 @@ void FunctionKeys(PLAYERp pp)
void PauseKey(PLAYERp pp)
{
extern SWBOOL GamePaused,CheatInputMode;
extern short QuickLoadNum;
extern SWBOOL enabled;
if (inputState.GetKeyStatus(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel)
@ -4252,6 +4299,14 @@ void getinput(SW_PACKET *loc)
SET(loc->bits, prev_weapon + 1);
}
if (buttonMap.ButtonDown(gamefunc_Alt_Weapon_Mode))
{
buttonMap.ClearButton(gamefunc_Alt_Weapon_Mode);
USERp u = User[pp->PlayerSprite];
short const which_weapon = u->WeaponNum + 1;
SET(loc->bits, which_weapon);
}
inv_hotkey = 0;
if (buttonMap.ButtonDown(gamefunc_Med_Kit))
inv_hotkey = INVENTORY_MEDKIT+1;

View file

@ -50,7 +50,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
//#define SW_SHAREWARE 1 // This determines whether game is shareware compile or not!
extern char isShareware, useDarts;
extern char isShareware;
#define SW_SHAREWARE (isShareware)
// Turn warning off for unreferenced variables.
@ -2372,6 +2372,12 @@ int COVERinsertsprite(short sectnum, short statnum); //returns (short)spritenu
void AudioUpdate(void); // stupid
extern short LastSaveNum;
extern short QuickLoadNum;
void LoadSaveMsg(const char *msg);
SWBOOL DoQuickSave(short save_num);
SWBOOL DoQuickLoad(void);
struct GameInterface : ::GameInterface
{
int app_main() override;

View file

@ -68,7 +68,6 @@ short TimeLimitTable[9] = {0,3,5,10,15,20,30,45,60};
short QuickLoadNum = -1;
char QuickLoadDescrDialog[128];
SWBOOL QuickSaveMode = FALSE;
SWBOOL SavePrompt = FALSE;
extern SWBOOL InMenuLevel, LoadGameOutsideMoveLoop, LoadGameFromDemo;
extern uint8_t RedBookSong[40];
@ -398,6 +397,8 @@ MenuItem options_i[] =
{DefButton(btn_auto_aim, 0, "Auto-Aiming"), OPT_XS, OPT_LINE(9), 1, m_defshade, 0, NULL, NULL, NULL},
{DefButton(btn_voxels, 0, "Voxel Sprites"), OPT_XS, OPT_LINE(10), 1, m_defshade, 0, NULL, NULL, NULL},
{DefButton(btn_stats, 0, "Level Stats"), OPT_XS, OPT_LINE(11), 1, m_defshade, 0, NULL, MNU_StatCheck, NULL},
{DefButton(btn_darts, 0, "Use Darts"), OPT_XS, OPT_LINE(12), 1, m_defshade, 0, NULL, NULL, NULL},
{DefButton(btn_autoswitch, 0, "Equip Pickups"), OPT_XS, OPT_LINE(13), 1, m_defshade, 0, NULL, NULL, NULL},
{DefNone}
};
@ -570,7 +571,6 @@ MenuItem_p cust_callback_item;
static void MNU_ClearDialog(void);
static SWBOOL MNU_Dialog(void);
void LoadSaveMsg(const char *msg);
static void MNU_ItemPreProcess(MenuGroup *group);
static void MNU_SelectItem(MenuGroup *group, short index, SWBOOL draw);
static void MNU_PushItem(MenuItem *item, SWBOOL draw);
@ -836,7 +836,7 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
// Todo: Branch off to the generic keybind menu.
const int PGSIZ = 9;
const char *strs[] = { "Select the function to assign to", "%s", "or ESCAPE to cancel." };
int topitem = 0, botitem = NUMGAMEFUNCTIONS-1;
int topitem = 0, botitem = NUMGAMEFUNCTIONS;
int i, j, y;
short w, h=0;
int returnval = 0;
@ -853,13 +853,13 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
}
else if (inputState.GetKeyStatus(sc_End))
{
*currentfunc = NUMGAMEFUNCTIONS-1; // -1 because the last one is the console and the top is 'none'
*currentfunc = NUMGAMEFUNCTIONS;
inputState.ClearKeyStatus(sc_End);
}
else if (inputState.GetKeyStatus(sc_PgDn))
{
*currentfunc += PGSIZ;
if (*currentfunc >= NUMGAMEFUNCTIONS) *currentfunc = NUMGAMEFUNCTIONS-1;
if (*currentfunc > NUMGAMEFUNCTIONS) *currentfunc = NUMGAMEFUNCTIONS;
inputState.ClearKeyStatus(sc_PgDn);
}
else if (inputState.GetKeyStatus(sc_PgUp))
@ -881,11 +881,11 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
else if (I_MenuDown())
{
I_MenuDownClear();
*currentfunc = min(NUMGAMEFUNCTIONS - 1, *currentfunc + 1);
*currentfunc = min(NUMGAMEFUNCTIONS, *currentfunc + 1);
}
if (NUMGAMEFUNCTIONS-1 > PGSIZ)
if (NUMGAMEFUNCTIONS > PGSIZ)
{
topitem = *currentfunc - PGSIZ/2;
botitem = topitem + PGSIZ;
@ -895,9 +895,9 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
botitem += -topitem;
topitem = 0;
}
else if (botitem >= NUMGAMEFUNCTIONS)
else if (botitem > NUMGAMEFUNCTIONS)
{
botitem = NUMGAMEFUNCTIONS-1;
botitem = NUMGAMEFUNCTIONS;
topitem = botitem - PGSIZ;
}
}
@ -941,7 +941,7 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
MNU_MeasureSmallString(morestr,&dx,&dy);
if (topitem > 0)
MNU_DrawSmallString(XDIM - OPT_XS - dx, OPT_LINE(4), morestr, 8,16);
if (botitem < NUMGAMEFUNCTIONS-1)
if (botitem < NUMGAMEFUNCTIONS)
MNU_DrawSmallString(XDIM - OPT_XS - dx, OPT_LINE(4)+PGSIZ*8, morestr, 8,16);
}
@ -1796,24 +1796,17 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item)
// Y pressed
cust_callback = NULL;
inputState.ClearKeysDown();
LoadSaveMsg("Loading...");
PauseAction();
ReloadPrompt = FALSE;
if (LoadGame(QuickLoadNum) == -1)
if (DoQuickLoad() == FALSE)
{
ResumeAction();
return FALSE;
}
ready2send = 1;
LastSaveNum = -1;
// do a load game here
inputState.ClearKeysDown();
ExitMenus();
return TRUE;
}
inputState.ClearKeysDown();
@ -1873,6 +1866,8 @@ MNU_InitMenus(void)
buttonsettings[btn_playcd] = true;// gs.PlayCD;
buttonsettings[btn_flipstereo] = snd_reversestereo;
buttonsettings[btn_stats] = hud_stats;
buttonsettings[btn_darts] = gs.Darts;
buttonsettings[btn_autoswitch] = gs.WeaponAutoSwitch;
slidersettings[sldr_gametype] = gs.NetGameType;
slidersettings[sldr_netlevel] = gs.NetLevel;
@ -2429,16 +2424,11 @@ SWBOOL MNU_GetSaveCustom(void)
if (MenuInputMode)
{
PauseAction();
LoadSaveMsg("Saving...");
if (SaveGame(save_num) != -1)
if (DoQuickSave(save_num) == FALSE)
{
QuickLoadNum = save_num;
LoadGameGroup.cursor = save_num;
LastSaveNum = -1;
}
ResumeAction();
@ -2523,15 +2513,6 @@ SWBOOL MNU_LoadSaveMove(UserCall call, MenuItem_p item)
SaveGameInfo2[0] = 0;
}
if (QuickSaveMode)
{
QuickSaveMode = FALSE;
MenuInputMode = TRUE;
strcpy(BackupSaveGameDescr, SaveGameDescr[game_num]);
inputState.ClearKeysDown();
inputState.keyFlushChars();
}
LastSaveNum = game_num;
// input mode check
@ -2943,6 +2924,12 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
case btn_stats:
hud_stats = state = buttonsettings[item->button];
break;
case btn_darts:
gs.Darts = state = buttonsettings[item->button];
break;
case btn_autoswitch:
gs.WeaponAutoSwitch = state = buttonsettings[item->button];
break;
case btn_markers:
gs.NetSpawnMarkers = state = buttonsettings[item->button];
break;

View file

@ -212,6 +212,8 @@ typedef enum
btn_markers, btn_teamplay, btn_friendlyfire,btn_parental,btn_nuke,
btn_voxels, btn_stats, btn_playcd,
btn_videofs,
btn_darts,
btn_autoswitch,
btn_max
} BTNType;

View file

@ -1822,7 +1822,7 @@ InitWeaponStar(PLAYERp pp)
PlaySound(DIGI_PULL, &pp->posx, &pp->posy, &pp->posz, v3df_follow|v3df_dontpan);
if (STD_RANDOM_RANGE(1000) > 900 && pp == Player+myconnectindex)
{
if (!useDarts)
if (!gs.Darts)
PlayerSound(DIGI_ILIKESHURIKEN,&pp->posx,&pp->posy,&pp->posz,v3df_follow|v3df_dontpan,pp);
}
@ -7389,7 +7389,7 @@ pDisplaySprites(PLAYERp pp)
picnum = psp->picndx;
// UK panzies have to have darts instead of shurikens.
if (useDarts)
if (gs.Darts)
switch (picnum)
{
case STAR_REST:
@ -7453,7 +7453,7 @@ pDisplaySprites(PLAYERp pp)
case STAR_REST:
case 2510:
if (!useDarts)
if (!gs.Darts)
picnum = 2138;
else
picnum = 2518; // Bloody Dart Hand

View file

@ -46,6 +46,8 @@ typedef struct
SWBOOL NetNuke;
//SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets.
char WaveformTrackName[MAXWAVEFORMTRACKLENGTH];
SWBOOL Darts;
SWBOOL WeaponAutoSwitch;
} GAME_SET, *GAME_SETp;
extern const GAME_SET gs_defaults;

View file

@ -651,8 +651,8 @@ short SoundAngle(int x, int y)
if (delta_angle < 0)
delta_angle = NORM_ANGLE((1024 + delta_angle) + 1024);
// convert 2048 degree angle to 32 degree angle
return delta_angle >> 6;
// convert 2048 degree angle to 128 degree angle
return delta_angle >> 4;
}
int _PlayerSound(const char *file, int line, int num, int *x, int *y, int *z, Voc3D_Flags flags, PLAYERp pp)

View file

@ -5959,8 +5959,7 @@ KeyMain:
if (pp->WpnAmmo[WPN_STAR] >= DamageData[WPN_STAR].max_ammo)
break;
//if (useDarts) sprintf(ds,"Darts");
//else sprintf(ds,"Shurikens");
sprintf(ds, gs.Darts ? "Darts" : "Shurikens");
PutStringInfo(Player+pnum, DamageData[WPN_STAR].weapon_name);
PlayerUpdateAmmo(pp, WPN_STAR, DamageData[WPN_STAR].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
@ -5970,6 +5969,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_STAR)))
break;
SET(pp->WpnFlags, BIT(WPN_STAR));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponStar(pp);
@ -5995,6 +5997,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_MINE)))
break;
SET(pp->WpnFlags, BIT(WPN_MINE));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponMine(pp);
@ -6036,6 +6041,9 @@ KeyMain:
ChoosePlayerGetSound(pp);
}
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
@ -6075,6 +6083,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_MICRO)))
break;
SET(pp->WpnFlags, BIT(WPN_MICRO));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponMicro(pp);
@ -6143,6 +6154,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_GRENADE)))
break;
SET(pp->WpnFlags, BIT(WPN_GRENADE));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponGrenade(pp);
@ -6169,6 +6183,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_ROCKET)))
break;
SET(pp->WpnFlags, BIT(WPN_ROCKET));
if (!gs.WeaponAutoSwitch)
break;
InitWeaponRocket(pp);
break;
@ -6213,6 +6230,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_RAIL)))
break;
SET(pp->WpnFlags, BIT(WPN_RAIL));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponRail(pp);
@ -6252,6 +6272,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_SHOTGUN)))
break;
SET(pp->WpnFlags, BIT(WPN_SHOTGUN));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponShotgun(pp);
@ -6318,6 +6341,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_HOTHEAD)))
break;
SET(pp->WpnFlags, BIT(WPN_NAPALM) | BIT(WPN_RING) | BIT(WPN_HOTHEAD));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_HOTHEAD && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;
InitWeaponHothead(pp);
@ -6362,6 +6388,9 @@ KeyMain:
break;
SET(pp->WpnFlags, BIT(WPN_HEART));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break;

View file

@ -7492,7 +7492,7 @@ const char *DeathString(short SpriteNum)
case 5011:
return "blade";
case STAR1:
if (useDarts) return "dart";
if (gs.Darts) return "dart";
else return "shuriken";
case CROSSBOLT:
return "crossbow bolt";