New unlimited power cheat; fine tuning of force powers in cheat menu

This commit is contained in:
Petr Bartos 2023-11-08 22:07:03 +01:00
parent 6f9f9c9ba0
commit 2ce51f6895
17 changed files with 352 additions and 43 deletions

View file

@ -335,7 +335,8 @@ static const char *gcmds[] = {
"use_lightamp_goggles",
"use_seeker",
"use_sentry",
"viewobjective"
"viewobjective",
"unlimitedpower"
};
static const size_t numgcmds = ARRAY_LEN( gcmds );

View file

@ -489,6 +489,32 @@ void Cmd_Undying_f (gentity_t *ent)
gi.SendServerCommand( ent-g_entities, "print \"%s\"", msg);
}
/*
==================
Cmd_UnlimitedPower_f
Grants unlimited power to client
argv(0) unlimitedpower
==================
*/
void Cmd_UnlimitedPower_f (gentity_t *ent)
{
const char *msg;
if ( !CheatsOk( ent ) ) {
return;
}
ent->flags ^= FL_UNLIMITEDPOWERMODE;
if (!(ent->flags & FL_UNLIMITEDPOWERMODE) )
msg = "unlimited power mode OFF\n";
else
msg = "unlimited power mode ON\n";
gi.SendServerCommand( ent-g_entities, "print \"%s\"", msg);
}
/*
==================
Cmd_Notarget_f
@ -1388,6 +1414,8 @@ void ClientCommand( int clientNum ) {
Cmd_God_f (ent);
else if (Q_stricmp (cmd, "undying") == 0)
Cmd_Undying_f (ent);
else if (Q_stricmp (cmd, "unlimitedpower") == 0)
Cmd_UnlimitedPower_f (ent);
else if (Q_stricmp (cmd, "notarget") == 0)
Cmd_Notarget_f (ent);
else if (Q_stricmp (cmd, "noclip") == 0)

View file

@ -75,7 +75,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define FL_OVERCHARGED_HEALTH 0x00100000 // Reduce health back to max
#define FL_NO_ANGLES 0x00200000 // No bone angle overrides, no pitch or roll in full angles
#define FL_RED_CROSSHAIR 0x00400000 // Crosshair red on me
#define FL_UNLIMITEDPOWERMODE 0x10000000 // Unlimited power mode
//Pointer safety utilities
#define VALID( a ) ( a != NULL )

View file

@ -12904,6 +12904,9 @@ void WP_ForcePowerDrain( gentity_t *self, forcePowers_t forcePower, int override
{//For now, NPCs have infinite force power
return;
}
if ( self->flags & FL_UNLIMITEDPOWERMODE) {
return;
}
//take away the power
int drain = overrideAmt;
if ( !drain )

View file

@ -114,6 +114,7 @@ static void UI_GetSaberCvars ( void );
static void UI_ResetSaberCvars ( void );
static void UI_InitAllocForcePowers ( const char *forceName );
static void UI_AffectForcePowerLevel ( const char *forceName );
static void UI_RotateForcePowerLevel ( const char *forceName );
static void UI_ShowForceLevelDesc ( const char *forceName );
static void UI_ResetForceLevels ( void );
static void UI_ClearWeapons ( void );
@ -1289,6 +1290,13 @@ static qboolean UI_RunMenuScript ( const char **args )
UI_AffectForcePowerLevel(forceName);
}
else if (Q_stricmp(name, "rotateforcepowerlevel") == 0)
{
const char *forceName;
String_Parse(args, &forceName);
UI_RotateForcePowerLevel(forceName);
}
else if (Q_stricmp(name, "decrementcurrentforcepower") == 0)
{
UI_DecrementCurrentForcePower();
@ -5331,6 +5339,64 @@ static void UI_AffectForcePowerLevel ( const char *forceName )
}
static void UI_RotateForcePowerLevel ( const char *forceName )
{
short forcePowerI=0,i;
menuDef_t *menu;
itemDef_t *item;
menu = Menu_GetFocused(); // Get current menu
if (!menu)
{
return;
}
if (!UI_GetForcePowerIndex ( forceName, &forcePowerI ))
{
return;
}
// Get player state
client_t* cl = &svs.clients[0]; // 0 because only ever us as a player
playerState_t* pState = NULL;
int forcelevel;
if( cl )
{
pState = cl->gentity->client;
forcelevel = pState->forcePowerLevel[powerEnums[forcePowerI].powerEnum];
}
else
{
forcelevel = uiInfo.forcePowerLevel[powerEnums[forcePowerI].powerEnum];
}
if (forcelevel < 3) {
forcelevel++;
} else {
forcelevel = 0;
}
// Increment power level.
DC->startLocalSound(uiInfo.uiDC.Assets.forceChosenSound, CHAN_AUTO );
uiInfo.forcePowerUpdated = forcePowerI; // Remember which power was updated
if( pState )
{
pState->forcePowerLevel[powerEnums[forcePowerI].powerEnum] = forcelevel;
pState->forcePowersKnown |= ( 1 << powerEnums[forcePowerI].powerEnum );
forcelevel = pState->forcePowerLevel[powerEnums[forcePowerI].powerEnum];
}
else
{
uiInfo.forcePowerLevel[powerEnums[forcePowerI].powerEnum] = forcelevel;
forcelevel = uiInfo.forcePowerLevel[powerEnums[forcePowerI].powerEnum];
}
UI_SetHexPicLevel( menu, uiInfo.forcePowerUpdated,forcelevel, qfalse );
}
static void UI_DecrementForcePowerLevel( void )
{
int forcePowerI = Cvar_VariableIntegerValue( "ui_forcepower_inc" );

View file

@ -310,7 +310,8 @@ static const char *gcmds[] = {
"use_lightamp_goggles",
"use_seeker",
"use_sentry",
"viewobjective"
"viewobjective",
"unlimitedpower"
};
static const size_t numgcmds = ARRAY_LEN( gcmds );

View file

@ -510,6 +510,32 @@ void Cmd_Undying_f (gentity_t *ent)
gi.SendServerCommand( ent-g_entities, "print \"%s\"", msg);
}
/*
==================
Cmd_UnlimitedPower_f
Grants unlimited power to client
argv(0) unlimitedpower
==================
*/
void Cmd_UnlimitedPower_f (gentity_t *ent)
{
const char *msg;
if ( !CheatsOk( ent ) ) {
return;
}
ent->flags ^= FL_UNLIMITEDPOWERMODE;
if (!(ent->flags & FL_UNLIMITEDPOWERMODE) )
msg = "unlimited power mode OFF\n";
else
msg = "unlimited power mode ON\n";
gi.SendServerCommand( ent-g_entities, "print \"%s\"", msg);
}
/*
==================
Cmd_Notarget_f
@ -1031,6 +1057,8 @@ void ClientCommand( int clientNum ) {
Cmd_God_f (ent);
else if (Q_stricmp (cmd, "undying") == 0)
Cmd_Undying_f (ent);
else if (Q_stricmp (cmd, "unlimitedpower") == 0)
Cmd_UnlimitedPower_f (ent);
else if (Q_stricmp (cmd, "notarget") == 0)
Cmd_Notarget_f (ent);
else if (Q_stricmp (cmd, "noclip") == 0)

View file

@ -73,6 +73,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define FL_DISINTEGRATED 0x00020000 // marks that the corpse has already been disintegrated
#define FL_FORCE_PULLABLE_ONLY 0x00040000 // cannot be force pushed
#define FL_NO_IMPACT_DMG 0x00080000 // Will not take impact damage
#define FL_UNLIMITEDPOWERMODE 0x10000000 // Unlimited power mode
//Pointer safety utilities
#define VALID( a ) ( a != NULL )

View file

@ -7717,6 +7717,9 @@ void WP_ForcePowerDrain( gentity_t *self, forcePowers_t forcePower, int override
{//For now, NPCs have infinite force power
return;
}
if ( self->flags & FL_UNLIMITEDPOWERMODE) {
return;
}
//take away the power
int drain = overrideAmt;
if ( !drain )

View file

@ -376,7 +376,8 @@ static const char *gcmds[] = {
"voice_cmd",
"vote",
"where",
"zoom"
"zoom",
"unlimitedpower"
};
static const size_t numgcmds = ARRAY_LEN( gcmds );

View file

@ -83,6 +83,7 @@ extern vec3_t gPainPoint;
#define FL_DONT_SHOOT 0x00040000
#define FL_SHIELDED 0x00080000
#define FL_UNDYING 0x00100000 // takes damage down to 1, but never dies
#define FL_UNLIMITEDPOWERMODE 0x10000000 // Unlimited power mode
//ex-eFlags -rww
#define FL_BOUNCE 0x00100000 // for missiles

View file

@ -259,11 +259,11 @@ LANG_ENGLISH "Give All Weapons"
REFERENCE CHEATS_GIVE_WEAPONS_DESC
LANG_ENGLISH "Gives all weapons."
REFERENCE CHEATS_GIVE_POWERS_ITEM
LANG_ENGLISH "Unlock All Powers"
REFERENCE CHEATS_UNLIMITED_POWER_ITEM
LANG_ENGLISH "Unlimited Force Power"
REFERENCE CHEATS_GIVE_POWERS_DESC
LANG_ENGLISH "Unlocks all force powers."
REFERENCE CHEATS_UNLIMITED_POWER_DESC
LANG_ENGLISH "Enables unlimited force power."
REFERENCE CHEATS_SABER_STYLE_TITLE
LANG_ENGLISH "Lightsaber Style:"
@ -334,6 +334,18 @@ LANG_ENGLISH "Lightsaber Burn Marks Cool Down:"
REFERENCE CHEATS_SABER_MARK_COOL_DOWN_DESC
LANG_ENGLISH "Set how long it takes for burn marks to cool down."
REFERENCE SENSE_FORCE
LANG_ENGLISH "Sense force"
REFERENCE SABER_DEFEND
LANG_ENGLISH "Saber defend"
REFERENCE SABER_ATTACK
LANG_ENGLISH "Saber attack"
REFERENCE SABER_THROW
LANG_ENGLISH "Saber throw"
REFERENCE WEAPON_CROSSHAIR_ITEM
LANG_ENGLISH "Weapon Crosshair:"

View file

@ -341,12 +341,12 @@ REFERENCE CHEATS_GIVE_WEAPONS_DESC
LANG_ENGLISH "Gives all weapons."
LANG_FRENCH "#same"
REFERENCE CHEATS_GIVE_POWERS_ITEM
LANG_ENGLISH "Unlock All Powers"
REFERENCE CHEATS_UNLIMITED_POWER_ITEM
LANG_ENGLISH "Unlimited Force Power"
LANG_FRENCH "#same"
REFERENCE CHEATS_GIVE_POWERS_DESC
LANG_ENGLISH "Unlocks all force powers."
REFERENCE CHEATS_UNLIMITED_POWER_DESC
LANG_ENGLISH "Enables unlimited force power."
LANG_FRENCH "#same"
REFERENCE CHEATS_SABER_STYLE_TITLE
@ -441,6 +441,22 @@ REFERENCE CHEATS_SABER_MARK_COOL_DOWN_DESC
LANG_ENGLISH "Set how long it takes for burn marks to cool down."
LANG_FRENCH "#same"
REFERENCE SENSE_FORCE
LANG_ENGLISH "Sense force"
LANG_FRENCH "#same"
REFERENCE SABER_DEFEND
LANG_ENGLISH "Saber defend"
LANG_FRENCH "#same"
REFERENCE SABER_ATTACK
LANG_ENGLISH "Saber attack"
LANG_FRENCH "#same"
REFERENCE SABER_THROW
LANG_ENGLISH "Saber throw"
LANG_FRENCH "#same"
REFERENCE WEAPON_CROSSHAIR_ITEM
LANG_ENGLISH "Weapon Crosshair:"
LANG_FRENCH "#same"

View file

@ -341,12 +341,12 @@ REFERENCE CHEATS_GIVE_WEAPONS_DESC
LANG_ENGLISH "Gives all weapons."
LANG_GERMAN "#same"
REFERENCE CHEATS_GIVE_POWERS_ITEM
LANG_ENGLISH "Unlock All Powers"
REFERENCE CHEATS_UNLIMITED_POWER_ITEM
LANG_ENGLISH "Unlimited Force Power"
LANG_GERMAN "#same"
REFERENCE CHEATS_GIVE_POWERS_DESC
LANG_ENGLISH "Unlocks all force powers."
REFERENCE CHEATS_UNLIMITED_POWER_DESC
LANG_ENGLISH "Enables unlimited force power."
LANG_GERMAN "#same"
REFERENCE CHEATS_SABER_STYLE_TITLE
@ -441,6 +441,22 @@ REFERENCE CHEATS_SABER_MARK_COOL_DOWN_DESC
LANG_ENGLISH "Set how long it takes for burn marks to cool down."
LANG_GERMAN "#same"
REFERENCE SENSE_FORCE
LANG_ENGLISH "Sense force"
LANG_GERMAN "#same"
REFERENCE SABER_DEFEND
LANG_ENGLISH "Saber defend"
LANG_GERMAN "#same"
REFERENCE SABER_ATTACK
LANG_ENGLISH "Saber attack"
LANG_GERMAN "#same"
REFERENCE SABER_THROW
LANG_ENGLISH "Saber throw"
LANG_GERMAN "#same"
REFERENCE WEAPON_CROSSHAIR_ITEM
LANG_ENGLISH "Weapon Crosshair:"
LANG_GERMAN "#same"

View file

@ -341,12 +341,12 @@ REFERENCE CHEATS_GIVE_WEAPONS_DESC
LANG_ENGLISH "Gives all weapons."
LANG_SPANISH "#same"
REFERENCE CHEATS_GIVE_POWERS_ITEM
LANG_ENGLISH "Unlock All Powers"
REFERENCE CHEATS_UNLIMITED_POWER_ITEM
LANG_ENGLISH "Unlimited Force Power"
LANG_SPANISH "#same"
REFERENCE CHEATS_GIVE_POWERS_DESC
LANG_ENGLISH "Unlocks all force powers."
REFERENCE CHEATS_UNLIMITED_POWER_DESC
LANG_ENGLISH "Enables unlimited force power."
LANG_SPANISH "#same"
REFERENCE CHEATS_SABER_STYLE_TITLE
@ -441,6 +441,22 @@ REFERENCE CHEATS_SABER_MARK_COOL_DOWN_DESC
LANG_ENGLISH "Set how long it takes for burn marks to cool down."
LANG_SPANISH "#same"
REFERENCE SENSE_FORCE
LANG_ENGLISH "Sense force"
LANG_SPANISH "#same"
REFERENCE SABER_DEFEND
LANG_ENGLISH "Saber defend"
LANG_SPANISH "#same"
REFERENCE SABER_ATTACK
LANG_ENGLISH "Saber attack"
LANG_SPANISH "#same"
REFERENCE SABER_THROW
LANG_ENGLISH "Saber throw"
LANG_SPANISH "#same"
REFERENCE WEAPON_CROSSHAIR_ITEM
LANG_ENGLISH "Weapon Crosshair:"
LANG_SPANISH "#same"

View file

@ -41,13 +41,6 @@
decoration
}
//----------------------------------------------------------------------------------------------
//
// CHEAT MENU ITEMS
//
//----------------------------------------------------------------------------------------------
itemDef
{
name screen_title
@ -63,6 +56,12 @@
decoration
}
//----------------------------------------------------------------------------------------------
//
// CHEAT MENU ITEMS
//
//----------------------------------------------------------------------------------------------
itemDef
{
name none
@ -238,8 +237,8 @@
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 340 100 200 20
text @MENUS_VR_CHEATS_GIVE_POWERS_ITEM
descText @MENUS_VR_CHEATS_GIVE_POWERS_DESC
text @MENUS_VR_CHEATS_UNLIMITED_POWER_ITEM
descText @MENUS_VR_CHEATS_UNLIMITED_POWER_DESC
font 2
textscale 1
textalignx 100
@ -251,7 +250,7 @@
action
{
play "sound/interface/button1.wav" ;
exec "setforceall 3"
exec "unlimitedpower"
}
}
@ -278,7 +277,7 @@
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 210 155 50 20
rect 190 155 50 20
text @MENUS_VR_CHEATS_SABER_STYLE_SINGLE_ITEM
descText @MENUS_VR_CHEATS_SABER_STYLE_SINGLE_DESC
font 2
@ -302,7 +301,7 @@
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 268 155 50 20
rect 248 155 50 20
text @MENUS_VR_CHEATS_SABER_STYLE_DUAL_ITEM
descText @MENUS_VR_CHEATS_SABER_STYLE_DUAL_DESC
font 2
@ -326,7 +325,7 @@
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 330 155 50 20
rect 310 155 50 20
text @MENUS_VR_CHEATS_SABER_STYLE_STAFF_ITEM
descText @MENUS_VR_CHEATS_SABER_STYLE_STAFF_DESC
font 2
@ -350,7 +349,7 @@
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 410 155 50 20
rect 390 155 50 20
text @MENUS_VR_CHEATS_SABER_STYLE_SITH_ITEM
descText @MENUS_VR_CHEATS_SABER_STYLE_SITH_DESC
font 2
@ -544,6 +543,131 @@
descText @MENUS_VR_CHEATS_SABER_MARK_COOL_DOWN_DESC
}
//----------------------------------------------------------------------------------------------
// CHANGE PAGE BUTTONS
//----------------------------------------------------------------------------------------------
itemDef
{
name prevpage_on
group none
style WINDOW_STYLE_SHADER
rect 225 357 32 26
background "gfx/menus/dp_arrow_lon"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef
{
name prevpage_off
group none
style WINDOW_STYLE_SHADER
rect 225 357 32 26
background "gfx/menus/dp_arrow_l"
forecolor 1 1 1 1
decoration
visible 1
}
itemDef
{
name prevpage
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 225 357 32 26
font 2
textscale 1
textalignx 48
textalign ITEM_ALIGN_CENTER
forecolor 1 .682 0 1
visible 1
action
{
play "sound/interface/button1.wav" ;
close all
open datapadCheats2Menu
}
mouseEnter
{
hide prevpage_off
show prevpage_on
}
mouseExit
{
show prevpage_off
hide prevpage_on
}
}
itemDef
{
name cheats
group none
style WINDOW_STYLE_EMPTY
rect 260 357 120 25
text "CHEATS (1/2)"
font 2
textscale 1
textalignx 60
textalign ITEM_ALIGN_CENTER
forecolor 1 .682 0 1
visible 1
decoration
}
itemDef
{
name nextpage_on
group none
style WINDOW_STYLE_SHADER
rect 384 357 32 26
background "gfx/menus/dp_arrow_ron"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef
{
name nextpage_off
group none
style WINDOW_STYLE_SHADER
rect 384 357 32 26
background "gfx/menus/dp_arrow_r"
forecolor 1 1 1 1
decoration
visible 1
}
itemDef
{
name nextpage
group none
style WINDOW_STYLE_EMPTY
type ITEM_TYPE_BUTTON
rect 384 357 32 26
font 2
textscale 1
textalignx 48
textalign ITEM_ALIGN_CENTER
forecolor 1 .682 0 1
visible 1
action
{
play "sound/interface/button1.wav" ;
close all
open datapadCheats2Menu
}
mouseEnter
{
hide nextpage_off
show nextpage_on
}
mouseExit
{
show nextpage_off
hide nextpage_on
}
}
//----------------------------------------------------------------------------------------------
// LOWER BUTTONS
//----------------------------------------------------------------------------------------------
@ -738,12 +862,3 @@
}
}
}

View file

@ -20,6 +20,7 @@
loadMenu { "ui/datapadweapons.menu" }
loadMenu { "ui/datapadmoves.menu" }
loadMenu { "ui/datapadcheats.menu" }
loadMenu { "ui/datapadcheats2.menu" }
loadMenu { "ui/error.menu" }
loadMenu { "ui/ingamevid_warning.menu" }