-
Notifications
You must be signed in to change notification settings - Fork 77
Weapon start fix #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Weapon start fix #563
Changes from 12 commits
6683eb5
85b2194
d3ed1cb
8241d5f
1babf91
f7a999c
923de14
03c8cd3
a33993c
e68eee7
051633e
7c253cd
49e0098
172e33f
64d78f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ namespace TFE_DarkForces | |
public: | ||
bool scriptRegister(ScriptAPI api) override; | ||
}; | ||
bool hasWeapon(s32 weapon); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
// Internal types need to be included in this case. | ||
#include <TFE_Jedi/InfSystem/infTypesInternal.h> | ||
#include <TFE_Jedi/Renderer/jediRenderer.h> | ||
#include <TFE_DarkForces/Scripting/gs_player.h> | ||
|
||
|
||
// TFE | ||
#include <TFE_System/tfeMessage.h> | ||
|
@@ -326,6 +327,7 @@ namespace TFE_DarkForces | |
// TFE | ||
void player_warp(const ConsoleArgList& args); | ||
void player_sector(const ConsoleArgList& args); | ||
JBool player_hasWeapon(s32 weapon); | ||
|
||
/////////////////////////////////////////// | ||
// API Implentation | ||
|
@@ -808,6 +810,19 @@ namespace TFE_DarkForces | |
disableNightVision(); | ||
hud_clearMessage(); | ||
} | ||
|
||
// Don't start the game with a weapon you don't have after overrides. | ||
if (!player_hasWeapon(s_playerInfo.curWeapon)) | ||
|
||
{ | ||
if (s_playerInfo.itemPistol) | ||
{ | ||
s_playerInfo.curWeapon = WPN_PISTOL; | ||
} | ||
else | ||
{ | ||
s_playerInfo.curWeapon = WPN_FIST; | ||
} | ||
} | ||
} | ||
|
||
void player_createController(JBool clearData) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ifeldshteyn
Can you please revert this -- you can't directly use
player_hasWeapon
fromplayer.cpp
because the argument it takes is not based on the same data.The argument here is the
WeaponId
enum whereFIST = 0
PISTOL = 1
RIFLE = 2
etc.
Whereas
player.cpp
player_hasWeapon
uses the keyboard numbersFIST = 1
PISTOL = 2
RIFLE = 3
...
There are also a couple of other minor differences -- eg.
player_hasWeapon
also assesses whether you have detonator and mines ammo.And the return value is JBool instead of primitive bool
So it is best to just leave the gs_player function as is.