From e68f7127fd1a3ea9e6bedd83b22dff8a3309b0f2 Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Fri, 20 May 2022 16:31:20 -0400 Subject: [PATCH 1/7] Add new console commands Added: - Ability to modify fire rate, accuracy, knockback/recoil, and damage multipliers for all weapons - Ability to modify how fast you run, how much stamina you use, how fast you blink, and your HP and Kevlar amounts - Ability to see all rooms and items loaded in your current zone - Documentation for all these commands as well - InstantKill makes bullet icon turn green - NoBlink makes blink icon and bar turn green --- SourceCode/Console.bb | 453 +++++++++++++++++++++++++++++++++++++++++- SourceCode/GUI.bb | 22 +- SourceCode/Guns.bb | 23 ++- SourceCode/Main.bb | 21 +- 4 files changed, 506 insertions(+), 13 deletions(-) diff --git a/SourceCode/Console.bb b/SourceCode/Console.bb index 0ac0074..e3bba02 100644 --- a/SourceCode/Console.bb +++ b/SourceCode/Console.bb @@ -36,7 +36,7 @@ Function UpdateConsole(commandSet%) Local x% = 0, y% = opt\GraphicHeight-300*MenuScale, width% = opt\GraphicWidth, height% = 300*MenuScale-30*MenuScale Local StrTemp$, temp%, i% - Local ev.Events, r.Rooms, it.Items + Local ev.Events, r.Rooms, it.Items, g.Guns DrawFrame x,y,width,height+30*MenuScale @@ -265,6 +265,22 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("- playmusic [clip + .wav/.ogg]") CreateConsoleMsg("- notarget") CreateConsoleMsg("- unlockexits") + CreateConsoleMsg("- infiniteammo") + CreateConsoleMsg("- instantkill") + CreateConsoleMsg("- noblink") + CreateConsoleMsg("- sethp") + CreateConsoleMsg("- setkevlar") + CreateConsoleMsg("- setweaponammo") + CreateConsoleMsg("- setreserveammo") + CreateConsoleMsg("- setspeedmult") + CreateConsoleMsg("- setstaminamult") + CreateConsoleMsg("- setblinkmult") + CreateConsoleMsg("- setdamagemult") + CreateConsoleMsg("- setknockbackmult") + CreateConsoleMsg("- setaccuracymult") + CreateConsoleMsg("- setfireratemult") + CreateConsoleMsg("- zoneroomlist") + CreateConsoleMsg("- zoneitemlist") Case "asd" CreateConsoleMsg("HELP - asd") CreateConsoleMsg("******************************") @@ -369,7 +385,127 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("Will play tracks in .ogg/.wav format") CreateConsoleMsg("from "+Chr(34)+"SFX\Music\Custom\"+Chr(34)+".") CreateConsoleMsg("******************************") - + Case "infiniteammo" + CreateConsoleMsg("HELP - infiniteammo") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Toggles infiniteammo, unless a valid parameter") + CreateConsoleMsg("is specified (on/off).") + CreateConsoleMsg("Allows the user to shoot any weapon") + CreateConsoleMsg("without losing ammo") + CreateConsoleMsg("******************************") + Case "instantkill" + CreateConsoleMsg("HELP - instantkill") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Toggles instantkill, unless a valid parameter") + CreateConsoleMsg("is specified (on/off).") + CreateConsoleMsg("Allows the user to kill any NPC") + CreateConsoleMsg("with one hit/shot") + CreateConsoleMsg("******************************") + Case "noblink" + CreateConsoleMsg("HELP - noblink") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Toggles noblink, unless a valid parameter") + CreateConsoleMsg("is specified (on/off).") + CreateConsoleMsg("Allows the user to not blink entirely") + CreateConsoleMsg("******************************") + Case "sethp" + CreateConsoleMsg("HELP - sethp") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users current HP.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Default is 100. 0 will kill you") + CreateConsoleMsg("******************************") + Case "setkevlar" + CreateConsoleMsg("HELP - setkevlar") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users current kevlar amount.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Default is 100.") + CreateConsoleMsg("******************************") + Case "setweaponammo" + CreateConsoleMsg("HELP - setweaponammo") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the magazine ammo for a weapon the user specifies.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Default is 'default'.") + CreateConsoleMsg("******************************") + Case "setreserveammo" + CreateConsoleMsg("HELP - setreserveammo") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the reserve magazine amount for a weapon the user specifies.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Default is 'default'.") + CreateConsoleMsg("******************************") + Case "setspeedmult" + CreateConsoleMsg("HELP - setspeedmult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users speed multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher speed = faster movement") + CreateConsoleMsg("Default is 1 or 'default'") + CreateConsoleMsg("******************************") + Case "setstaminamult" + CreateConsoleMsg("HELP - setstaminamult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users stamina multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = more stamina usage") + CreateConsoleMsg("Default is 1 or 'default'") + CreateConsoleMsg("******************************") + Case "setblinkmult" + CreateConsoleMsg("HELP - setblinkmult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users blinking time multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = faster blinking time") + CreateConsoleMsg("Default is 1 or 'default'") + CreateConsoleMsg("******************************") + Case "setdamagemult" + CreateConsoleMsg("HELP - setdamagemult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users gun damage multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = stronger damage against NPCs") + CreateConsoleMsg("Default is 1 or 'default'") + CreateConsoleMsg("******************************") + Case "setknockbackmult" + CreateConsoleMsg("HELP - setknockbackmult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users gun knockback (recoil) multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = stronger camera shake and recoil") + CreateConsoleMsg("Default is 'default'") + CreateConsoleMsg("******************************") + Case "setaccuracymult" + CreateConsoleMsg("HELP - setaccuracymult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users gun accuracy multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = less accuracy") + CreateConsoleMsg("Default is 'default'") + CreateConsoleMsg("******************************") + Case "setfireratemult" + CreateConsoleMsg("HELP - setfireratemult") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Sets the users fire rate multiplier.") + CreateConsoleMsg("Should be set to a value at 0 or above") + CreateConsoleMsg("Higher multiplier = faster firing") + CreateConsoleMsg("Default is 'default'") + CreateConsoleMsg("******************************") + Case "zoneroomlist" + CreateConsoleMsg("HELP - zoneroomlist") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Shows the current loaded rooms for the zone you are in.") + CreateConsoleMsg("Going to different zones will show different names") + CreateConsoleMsg("Room names may be duplicated when displaying") + CreateConsoleMsg("******************************") + Case "zoneitemlist" + CreateConsoleMsg("HELP - zoneitemlist") + CreateConsoleMsg("******************************") + CreateConsoleMsg("Shows the current loaded items for the zone you are in.") + CreateConsoleMsg("Going to different zones will show different items") + CreateConsoleMsg("Room items may be duplicated when displaying") + CreateConsoleMsg("******************************") Default CreateConsoleMsg("There is no help available for that command.",255,150,0) End Select @@ -632,6 +768,7 @@ Function UpdateConsole(commandSet%) If SuperMan = True Then CreateConsoleMsg("GOTTA GO FAST") Else + Speed = 0.018 CreateConsoleMsg("WHOA SLOW DOWN") EndIf ;[End Block] @@ -1023,6 +1160,318 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("The current room doesn't has any event applied.",255,150,0) EndIf EndIf + Case "infiniteammo" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + + Select StrTemp + Case "on", "1", "true" + InfiniteAmmo% = True + Case "off", "0", "false" + InfiniteAmmo% = False + Default + InfiniteAmmo% = Not InfiniteAmmo% + End Select + + If InfiniteAmmo% = False Then + CreateConsoleMsg("INFINITE AMMO OFF") + Else + CreateConsoleMsg("INFINITE AMMO ON") + EndIf + Case "instantkill" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + + Select StrTemp + Case "on", "1", "true" + InstantKill% = True + Case "off", "0", "false" + InstantKill% = False + Default + InstantKill% = Not InstantKill% + End Select + + If InstantKill% = False Then + CreateConsoleMsg("INSTANT KILL OFF") + Else + CreateConsoleMsg("INSTANT KILL ON") + EndIf + Case "noblink" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + + Select StrTemp + Case "on", "1", "true" + NoBlink% = True + Case "off", "0", "false" + NoBlink% = False + Default + NoBlink% = Not NoBlink% + End Select + + If NoBlink% = False Then + CreateConsoleMsg("NO BLINK OFF") + Else + CreateConsoleMsg("NO BLINK ON") + EndIf + Case "sethp" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: sethp (amount)", 255, 0, 0) + Else + Local HPInt = Int(StrTemp) + If HPInt < 0 Then + CreateConsoleMsg("You cannot have your health less than 0", 255, 0, 0) + ElseIf HPInt = 0 Then + Kill() + Else + psp\Health = HPInt + EndIf + CreateConsoleMsg("HP set to " + HPInt) + EndIf + Case "setkevlar" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setkevlar (amount)", 255, 0, 0) + Else + Local KevlarInt = Int(StrTemp) + If KevlarInt < 0 Then + CreateConsoleMsg("You cannot have your kevlar less than 0", 255, 0, 0) + Else + psp\Kevlar = Int(StrTemp) + EndIf + CreateConsoleMsg("Kevlar set to " + Int(psp\Kevlar)) + EndIf + Case "setweaponammo" + args$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + Local GunName$ = Piece$(args$, 1, " ") + Local MagazineAmount$ = Piece$(args$, 2, " ") + Local GunFound = False + If GunName = "" Lor MagazineAmount = "" Then + CreateConsoleMsg("Too few parameters. Usage: setweaponammo (gun) (amount)", 255, 0, 0) + Else + If MagazineAmount = "default" + For g = Each Guns + If g\name = GunName Then + g\CurrAmmo = GetINIInt("Data\weapons.ini", g\name, "ammo") + g\MaxCurrAmmo = GetINIInt("Data\weapons.ini", g\name, "ammo") + GunFound = True + EndIf + Next + If GunFound Then + CreateConsoleMsg(GunName + " magazine ammo set to default") + EndIf + Else + Local MagazineAmountInt = Int(MagazineAmount) + If MagazineAmountInt < 0 Then + CreateConsoleMsg("You cannot have a magazine ammount less than 0", 255, 0, 0) + Else + For g = Each Guns + If g\name = GunName Then + g\CurrAmmo = MagazineAmountInt + g\MaxCurrAmmo = MagazineAmountInt + GunFound = True + EndIf + Next + If GunFound Then + CreateConsoleMsg(GunName + " magazine ammo set to " + MagazineAmountInt) + EndIf + EndIf + EndIf + If (Not GunFound) Then + CreateConsoleMsg("Weapon " + GunName + " does not exist", 255, 0, 0) + EndIf + EndIf + Case "setreserveammo" + args$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + Local GunName2$ = Piece$(args$,1," ") + Local ReserveAmount$ = Piece$(args$,2," ") + Local GunFound2 = False + If GunName2 = "" Lor ReserveAmount = "" Then + CreateConsoleMsg("Too few parameters. Usage: setreserveammo (gun) (amount)", 255, 0, 0) + Else + If ReserveAmount = "default" + For g = Each Guns + If g\name = GunName2 Then + g\CurrReloadAmmo = GetINIInt("Data\weapons.ini", g\name, "reload_ammo") + g\MaxReloadAmmo = GetINIInt("Data\weapons.ini", g\name, "reload_ammo") + GunFound2 = True + EndIf + Next + If GunFound2 Then + CreateConsoleMsg(GunName2 + " reserve ammo set to default") + EndIf + Else + Local ReserveAmountInt = Int(ReserveAmount) + If ReserveAmountInt < 0 Then + CreateConsoleMsg("You cannot have a reserve magazine ammount less than 0", 255, 0, 0) + Else + For g = Each Guns + If g\name = GunName2 Then + g\CurrReloadAmmo = ReserveAmountInt + g\MaxReloadAmmo = ReserveAmountInt + GunFound2 = True + EndIf + Next + If GunFound2 Then + CreateConsoleMsg(GunName2 + " reserve ammo set to " + ReserveAmountInt) + EndIf + EndIf + EndIf + If (Not GunFound2) Then + CreateConsoleMsg("Weapon " + GunName2 + " does not exist", 255, 0, 0) + EndIf + EndIf + Case "setspeedmult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setspeedmult (amount)", 255, 0, 0) + Else + If Lower(StrTemp) = "default" Then + Speed = 0.018 + CreateConsoleMsg("Speed multiplier set to default") + Else + Local SpeedTemp = Float(StrTemp) + If SpeedTemp < 0 Then + CreateConsoleMsg("You cannot have a speed multiplier less than 0", 255, 0, 0) + Else + Speed = SpeedTemp * 0.018 + CreateConsoleMsg("Speed multiplier set to " + Speed + "x") + EndIf + EndIf + EndIf + Case "setstaminamult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setstaminamult (amount)", 255, 0, 0) + Else + If Lower(StrTemp) = "default" Then + StaminaEffect = 1.0 + StaminaEffectTimer = 2147483647 + CreateConsoleMsg("Stamina use multiplier set to default") + Else + StaminaEffect = Float(StrTemp) + If StaminaEffect < 0 Then + StaminaEffect = 1.0 + CreateConsoleMsg("You cannot have a stamina use multiplier less than 0", 255, 0, 0) + Else + StaminaEffectTimer = 2147483647 + CreateConsoleMsg("Stamina use multiplier set to " + StaminaEffect + "x") + EndIf + EndIf + EndIf + + Case "setblinkmult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setblinkmult (amount)", 255, 0, 0) + Else + If Lower(StrTemp) = "default" Then + BlinkEffect = 1.0 + BlinkEffectTimer = 2147483647 + CreateConsoleMsg("Blinking time multiplier set to default") + Else + BlinkEffect = Float(StrTemp) + If BlinkEffect < 0 Then + BlinkEffect = 1.0 + CreateConsoleMsg("You cannot have a blink multiplier less than 0", 255, 0, 0) + Else + BlinkEffectTimer = 2147483647 + CreateConsoleMsg("Blinking time multiplier set to " + BlinkEffect + "x") + EndIf + EndIf + EndIf + Case "setdamagemult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setdamagemult (amount)", 255, 0, 0) + Else + If Lower(StrTemp) = "default" Then + DamageMultiplier = 1.0 + CreateConsoleMsg("Damage multiplier set to default") + Else + DamageMultiplier = Float(StrTemp) + If DamageMultiplier < 0 Then + DamageMultiplier = 1.0 + CreateConsoleMsg("You cannot have a damage multiplier less than 0", 255, 0, 0) + Else + CreateConsoleMsg("Damage multiplier set to " + DamageMultiplier + "x") + EndIf + EndIf + EndIf + Case "setknockbackmult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setknockbackmult (amount)", 255, 0, 0) + Else + Local KnockbackResult = Float(StrTemp) + If Lower(StrTemp) = "default" Then + For g = Each Guns + g\Knockback = GetINIFloat("Data\weapons.ini", g\name, "knockback") + Next + CreateConsoleMsg("Knockback multiplier set to default") + Else + If KnockbackResult < 0 Then + CreateConsoleMsg("You cannot have a knockback multiplier less than 0", 255, 0, 0) + Else + For g = Each Guns + g\Knockback = GetINIFloat("Data\weapons.ini", g\name, "knockback") * KnockbackResult + Next + CreateConsoleMsg("Knockback multiplier set to " + KnockbackResult + "x") + EndIf + EndIf + EndIf + Case "setaccuracymult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setaccuracymult (amount)", 255, 0, 0) + Else + Local AccuracyResult = Float(StrTemp) + If Lower(StrTemp) = "default" Then + For g = Each Guns + g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") + Next + CreateConsoleMsg("Knockback multiplier set to default") + Else + If AccuracyResult < 0 Then + CreateConsoleMsg("You cannot have a accuracy multiplier less than 0", 255, 0, 0) + Else + For g = Each Guns + g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") * AccuracyResult + Next + CreateConsoleMsg("Accuracy multiplier set to " + AccuracyResult + "x") + EndIf + EndIf + EndIf + Case "setfireratemult" + StrTemp$ = Lower(Right(ConsoleInput, Len(ConsoleInput) - Instr(ConsoleInput, " "))) + If StrTemp = "" Then + CreateConsoleMsg("Too few parameters. Usage: setfireratemult (amount)", 255, 0, 0) + Else + Local RateOfFireResult = Float(StrTemp) + If Lower(StrTemp) = "default" Then + For g = Each Guns + g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") + Next + CreateConsoleMsg("Rate of fire multiplier set to default") + Else + If RateOfFireResult < 0 Then + CreateConsoleMsg("You cannot have a rate of fire multiplier less than 0", 255, 0, 0) + Else + For g = Each Guns + g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") * RateOfFireResult + Next + CreateConsoleMsg("Rate of fire multiplier set to " + RateOfFireResult + "x") + EndIf + EndIf + EndIf + Case "zoneroomlist" + CreateConsoleMsg("List of all rooms loaded in this current zone:") + For r = Each Rooms + CreateConsoleMsg("- " + r\roomtemplate.roomtemplates\Name) + Next + Case "zoneitemlist" + CreateConsoleMsg("List of all items loaded in this current zone:") + For it = Each Items + CreateConsoleMsg("- " + it\itemtemplate\tempname + " | " + it\itemtemplate\name) + Next ;[End Block] ; Case "giveachievement" ;[Block] diff --git a/SourceCode/GUI.bb b/SourceCode/GUI.bb index 76e1f29..18827c7 100644 --- a/SourceCode/GUI.bb +++ b/SourceCode/GUI.bb @@ -2322,8 +2322,16 @@ Function DrawGUI() x% = 80 y% = opt\GraphicHeight - 95 + If NoBlink Then + BlinkTimer = BLINKFREQ + EndIf + ;Blinking Bar - Color 255, 255, 255 + If (Not NoBlink) Then + Color 255, 255, 255 + Else + Color 0, 255, 0 + EndIf Rect (x, y, width, height, False) For i = 1 To Int(((width - 2) * (BlinkTimer / (BLINKFREQ))) / 10) DrawImage(BlinkMeterIMG, x + 3 + 10 * (i - 1), y + 3) @@ -2336,7 +2344,11 @@ Function DrawGUI() Rect(x - 50 - 3, y - 3, 30 + 6, 30 + 6) End If - Color 255, 255, 255 + If (Not NoBlink) Then + Color 255, 255, 255 + Else + Color 0, 255, 0 + EndIf Rect(x - 50 - 1, y - 1, 30 + 2, 30 + 2, False) DrawImage BlinkIcon, x - 50, y @@ -3474,7 +3486,11 @@ Function DrawGunsInHUD() If g\ID = g_I\HoldingGun Then If (g\GunType <> GUNTYPE_MELEE) Then If pAmmo > 0 Then - Color 255,255,255 + If InstantKill Then + Color 0, 255, 0 + Else + Color 255, 255, 255 + EndIf Else Color 255,0,0 EndIf diff --git a/SourceCode/Guns.bb b/SourceCode/Guns.bb index 604b683..531dd93 100644 --- a/SourceCode/Guns.bb +++ b/SourceCode/Guns.bb @@ -1004,7 +1004,9 @@ Function UpdateGuns() For j=1 To g\Amount_Of_Bullets ShootGun(g) Next - pAmmo = pAmmo - 1 + If (Not InfiniteAmmo) Then + pAmmo = pAmmo - 1 + EndIf pShootState = FPSfactor pReloadState = 0.0 EndIf @@ -1065,7 +1067,9 @@ Function UpdateGuns() For j=1 To g\Amount_Of_Bullets ShootGun(g) Next - pAmmo = pAmmo - 1 + If (Not InfiniteAmmo) Then + pAmmo = pAmmo - 1 + EndIf pShootState = FPSfactor pPressReload = False EndIf @@ -1093,6 +1097,9 @@ Function UpdateGuns() pReloadAmmo = pReloadAmmo - 1 EndIf EndIf + If InfiniteAmmo Then + pAmmo = g\MaxCurrAmmo + EndIf EndIf EndIf Next @@ -1936,12 +1943,20 @@ Function ShootGun(g.Guns) Exit EndIf If ent_pick% = n\HitBox2[j] Then ;Body has been shot, doing damage with g\DamageOnEntity - n\HP = n\HP - g\DamageOnEntity + If InstantKill Then + n\HP = 0 + Else + n\HP = n\HP - (g\DamageOnEntity * DamageMultiplier) + EndIf hitNPC = n Exit EndIf If ent_pick% = n\HitBox3[j] Then ;Arms or legs have been shot, doing damage with g\DamageOnEntity/2 - n\HP = n\HP - (g\DamageOnEntity/2) + If InstantKill Then + n\HP = 0 + Else + n\HP = n\HP - ((g\DamageOnEntity/2) * DamageMultiplier) + EndIf hitNPC = n Exit EndIf diff --git a/SourceCode/Main.bb b/SourceCode/Main.bb index 71a3bfa..8e207a1 100644 --- a/SourceCode/Main.bb +++ b/SourceCode/Main.bb @@ -368,6 +368,7 @@ Global RefinedItems% Global DropSpeed#, HeadDropSpeed#, CurrSpeed# Global user_camera_pitch#, side# Global Crouch%, CrouchState# +Global Speed# = 0.018 Global PlayerZone%, PlayerRoom.Rooms @@ -457,6 +458,8 @@ Global BlurVolume#, BlurTimer# Global LightBlink#, LightFlash# +Global DamageMultiplier# = 1.0 + Global BumpEnabled% = GetINIInt(gv\OptionFile, "options", "bump mapping enabled", 1) Global HUDenabled% = GetINIInt(gv\OptionFile, "options", "HUD enabled", 1) @@ -674,6 +677,9 @@ Global MonitorTimer# = 0.0, MonitorTimer2# = 0.0, UpdateCheckpoint1%, UpdateChec Global PlayerDetected% ;Global PrevInjuries#,PrevBloodloss# Global NoTarget% = False +Global NoBlink% = False +Global InfiniteAmmo% = False +Global InstantKill% = False Global NVGImages = LoadAnimImage("GFX\battery.png",64,64,0,2) MaskImage NVGImages,255,0,255 @@ -1592,7 +1598,12 @@ Function MainLoop() Wend ;Go out of function immediately if the game has been quit - If MainMenuOpen Then Return + If MainMenuOpen Then + ; Fix for modified speed applying to other saves + ; Speed resets when the game is exited + Speed = 0.018 + Return + EndIf If FPSfactor > 0 And PlayerRoom\RoomTemplate\Name <> "dimension1499" Then RenderSecurityCams() @@ -2502,12 +2513,14 @@ End Function Function MovePlayer() CatchErrors("Uncaught (MovePlayer)") - Local Sprint# = 1.0, Speed# = 0.018, i%, angle# + Local Sprint# = 1.0, i%, angle# ;IsPlayerSprinting% = False If SuperMan Then - Speed = Speed * 3 + If Speed = 0.018 Then + Speed = Speed * 3 + EndIf SuperManTimer=SuperManTimer+FPSfactor @@ -2522,7 +2535,7 @@ Function MovePlayer() BlurTimer = 500 HideEntity Fog EndIf - End If + EndIf If DeathTimer > 0 Then DeathTimer=DeathTimer-FPSfactor From 80c51ba3ff4e6d2ac0ab6f1b94952a0f4e008bad Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Fri, 20 May 2022 16:38:07 -0400 Subject: [PATCH 2/7] Add signifiers to bullet icon for damage mods Green = Buff, Red = Detriment --- SourceCode/GUI.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SourceCode/GUI.bb b/SourceCode/GUI.bb index 18827c7..6ead2a5 100644 --- a/SourceCode/GUI.bb +++ b/SourceCode/GUI.bb @@ -3486,8 +3486,10 @@ Function DrawGunsInHUD() If g\ID = g_I\HoldingGun Then If (g\GunType <> GUNTYPE_MELEE) Then If pAmmo > 0 Then - If InstantKill Then + If InstantKill Or DamageMultiplier > 1.0 Then Color 0, 255, 0 + ElseIf DamageMultiplier < 1.0 Then + Color 255, 0, 0 Else Color 255, 255, 255 EndIf From 3b7e545238430b610eb32b0b5f4b1ac3d444d685 Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Sat, 21 May 2022 10:20:03 -0400 Subject: [PATCH 3/7] Update help for setweapon/reserve ammo command Make it more descriptive --- SourceCode/Console.bb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SourceCode/Console.bb b/SourceCode/Console.bb index e3bba02..69b9474 100644 --- a/SourceCode/Console.bb +++ b/SourceCode/Console.bb @@ -426,15 +426,17 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("HELP - setweaponammo") CreateConsoleMsg("******************************") CreateConsoleMsg("Sets the magazine ammo for a weapon the user specifies.") - CreateConsoleMsg("Should be set to a value at 0 or above") - CreateConsoleMsg("Default is 'default'.") + CreateConsoleMsg("First parameter should be a weapon name (no spaces)") + CreateConsoleMsg("Second parameter should be set to a value at 0 or above") + CreateConsoleMsg("Default for second parameter is 'default'.") CreateConsoleMsg("******************************") Case "setreserveammo" CreateConsoleMsg("HELP - setreserveammo") CreateConsoleMsg("******************************") CreateConsoleMsg("Sets the reserve magazine amount for a weapon the user specifies.") - CreateConsoleMsg("Should be set to a value at 0 or above") - CreateConsoleMsg("Default is 'default'.") + CreateConsoleMsg("First parameter should be a weapon name (no spaces)") + CreateConsoleMsg("Second parameter should be set to a value at 0 or above") + CreateConsoleMsg("Default for second parameter is 'default'.") CreateConsoleMsg("******************************") Case "setspeedmult" CreateConsoleMsg("HELP - setspeedmult") From b9b37f96cfd4dcc28227f7a33655925c2f75b2cb Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Mon, 23 May 2022 09:19:14 -0400 Subject: [PATCH 4/7] Fix number casts, sprint icon colors, damage multiplier reset when exit This will make all multiplier based commands work properly. Error was due to not having a # to represent it as a decimal --- SourceCode/Console.bb | 26 +++++++++++++------------- SourceCode/GUI.bb | 4 +++- SourceCode/Main.bb | 1 + 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/SourceCode/Console.bb b/SourceCode/Console.bb index 69b9474..fe926b9 100644 --- a/SourceCode/Console.bb +++ b/SourceCode/Console.bb @@ -491,7 +491,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("******************************") CreateConsoleMsg("Sets the users fire rate multiplier.") CreateConsoleMsg("Should be set to a value at 0 or above") - CreateConsoleMsg("Higher multiplier = faster firing") + CreateConsoleMsg("Higher multiplier = slower firing") CreateConsoleMsg("Default is 'default'") CreateConsoleMsg("******************************") Case "zoneroomlist" @@ -1330,12 +1330,12 @@ Function UpdateConsole(commandSet%) Speed = 0.018 CreateConsoleMsg("Speed multiplier set to default") Else - Local SpeedTemp = Float(StrTemp) - If SpeedTemp < 0 Then + Local SpeedTemp# = Float(StrTemp) + If SpeedTemp < 0.0 Then CreateConsoleMsg("You cannot have a speed multiplier less than 0", 255, 0, 0) Else Speed = SpeedTemp * 0.018 - CreateConsoleMsg("Speed multiplier set to " + Speed + "x") + CreateConsoleMsg("Speed multiplier set to " + SpeedTemp + "x") EndIf EndIf EndIf @@ -1350,7 +1350,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("Stamina use multiplier set to default") Else StaminaEffect = Float(StrTemp) - If StaminaEffect < 0 Then + If StaminaEffect < 0.0 Then StaminaEffect = 1.0 CreateConsoleMsg("You cannot have a stamina use multiplier less than 0", 255, 0, 0) Else @@ -1371,7 +1371,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("Blinking time multiplier set to default") Else BlinkEffect = Float(StrTemp) - If BlinkEffect < 0 Then + If BlinkEffect < 0.0 Then BlinkEffect = 1.0 CreateConsoleMsg("You cannot have a blink multiplier less than 0", 255, 0, 0) Else @@ -1390,7 +1390,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("Damage multiplier set to default") Else DamageMultiplier = Float(StrTemp) - If DamageMultiplier < 0 Then + If DamageMultiplier < 0.0 Then DamageMultiplier = 1.0 CreateConsoleMsg("You cannot have a damage multiplier less than 0", 255, 0, 0) Else @@ -1403,14 +1403,14 @@ Function UpdateConsole(commandSet%) If StrTemp = "" Then CreateConsoleMsg("Too few parameters. Usage: setknockbackmult (amount)", 255, 0, 0) Else - Local KnockbackResult = Float(StrTemp) + Local KnockbackResult# = Float(StrTemp) If Lower(StrTemp) = "default" Then For g = Each Guns g\Knockback = GetINIFloat("Data\weapons.ini", g\name, "knockback") Next CreateConsoleMsg("Knockback multiplier set to default") Else - If KnockbackResult < 0 Then + If KnockbackResult < 0.0 Then CreateConsoleMsg("You cannot have a knockback multiplier less than 0", 255, 0, 0) Else For g = Each Guns @@ -1425,14 +1425,14 @@ Function UpdateConsole(commandSet%) If StrTemp = "" Then CreateConsoleMsg("Too few parameters. Usage: setaccuracymult (amount)", 255, 0, 0) Else - Local AccuracyResult = Float(StrTemp) + Local AccuracyResult# = Float(StrTemp) If Lower(StrTemp) = "default" Then For g = Each Guns g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") Next CreateConsoleMsg("Knockback multiplier set to default") Else - If AccuracyResult < 0 Then + If AccuracyResult < 0.0 Then CreateConsoleMsg("You cannot have a accuracy multiplier less than 0", 255, 0, 0) Else For g = Each Guns @@ -1447,14 +1447,14 @@ Function UpdateConsole(commandSet%) If StrTemp = "" Then CreateConsoleMsg("Too few parameters. Usage: setfireratemult (amount)", 255, 0, 0) Else - Local RateOfFireResult = Float(StrTemp) + Local RateOfFireResult# = Float(StrTemp) If Lower(StrTemp) = "default" Then For g = Each Guns g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") Next CreateConsoleMsg("Rate of fire multiplier set to default") Else - If RateOfFireResult < 0 Then + If RateOfFireResult < 0.0 Then CreateConsoleMsg("You cannot have a rate of fire multiplier less than 0", 255, 0, 0) Else For g = Each Guns diff --git a/SourceCode/GUI.bb b/SourceCode/GUI.bb index 6ead2a5..5fe8817 100644 --- a/SourceCode/GUI.bb +++ b/SourceCode/GUI.bb @@ -2410,8 +2410,10 @@ Function DrawGUI() Color 0, 0, 0 Rect(x - 50, y, 30, 30) - If Stamina <= 0.0 Then + If Stamina <= 0.0 Or Speed < 0.018 Then Color 255, 0, 0 + ElseIf Speed > 0.018 + Color 0, 255, 0 Else Color 255, 255, 255 EndIf diff --git a/SourceCode/Main.bb b/SourceCode/Main.bb index 8e207a1..0705eff 100644 --- a/SourceCode/Main.bb +++ b/SourceCode/Main.bb @@ -1602,6 +1602,7 @@ Function MainLoop() ; Fix for modified speed applying to other saves ; Speed resets when the game is exited Speed = 0.018 + DamageMultiplier = 1.0 Return EndIf From 5141cceafc33aaee4b54b640c6c63bce497a8f90 Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Mon, 23 May 2022 11:16:47 -0400 Subject: [PATCH 5/7] Fix new console variables not resetting Oversight --- SourceCode/Main.bb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/SourceCode/Main.bb b/SourceCode/Main.bb index 0705eff..1c1206b 100644 --- a/SourceCode/Main.bb +++ b/SourceCode/Main.bb @@ -1598,13 +1598,7 @@ Function MainLoop() Wend ;Go out of function immediately if the game has been quit - If MainMenuOpen Then - ; Fix for modified speed applying to other saves - ; Speed resets when the game is exited - Speed = 0.018 - DamageMultiplier = 1.0 - Return - EndIf + If MainMenuOpen Then Return If FPSfactor > 0 And PlayerRoom\RoomTemplate\Name <> "dimension1499" Then RenderSecurityCams() @@ -3994,6 +3988,7 @@ Function NullGame(nomenuload%=False,playbuttonsfx%=True) Local i%, x%, y%, lvl Local itt.ItemTemplates, s.Screens Local rt.RoomTemplates + Local g.Guns Local PlayerRoomName$ = PlayerRoom\RoomTemplate\Name Local PlayerRoomZone = NTF_CurrZone @@ -4068,8 +4063,20 @@ Function NullGame(nomenuload%=False,playbuttonsfx%=True) Shake = 0 LightFlash = 0 + Speed = 0.018 + DamageMultiplier = 1.0 + + For g = Each Guns + g\Knockback = GetINIFloat("Data\weapons.ini", g\name, "knockback") + g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") + g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") + Next + GodMode = 0 NoClip = 0 + NoBlink = 0 + InfiniteAmmo = 0 + InstantKill = 0 WireframeState = 0 WireFrame 0 WearingGasMask = 0 From 1c9b408b8398bd1ad8c1f16b5b37048077c8005c Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Mon, 23 May 2022 18:41:04 -0400 Subject: [PATCH 6/7] Update accuracy + rof formula to be consistent Instead of doing 0.5x for more, it'll be 0,5x for less for example. Rate of fire and accuracy should increase as the multiplier goes up --- SourceCode/Console.bb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SourceCode/Console.bb b/SourceCode/Console.bb index fe926b9..00e842f 100644 --- a/SourceCode/Console.bb +++ b/SourceCode/Console.bb @@ -483,7 +483,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("******************************") CreateConsoleMsg("Sets the users gun accuracy multiplier.") CreateConsoleMsg("Should be set to a value at 0 or above") - CreateConsoleMsg("Higher multiplier = less accuracy") + CreateConsoleMsg("Higher multiplier = more accuracy") CreateConsoleMsg("Default is 'default'") CreateConsoleMsg("******************************") Case "setfireratemult" @@ -491,7 +491,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("******************************") CreateConsoleMsg("Sets the users fire rate multiplier.") CreateConsoleMsg("Should be set to a value at 0 or above") - CreateConsoleMsg("Higher multiplier = slower firing") + CreateConsoleMsg("Higher multiplier = faster firing") CreateConsoleMsg("Default is 'default'") CreateConsoleMsg("******************************") Case "zoneroomlist" @@ -1436,7 +1436,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("You cannot have a accuracy multiplier less than 0", 255, 0, 0) Else For g = Each Guns - g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") * AccuracyResult + g\Accuracy = GetINIFloat("Data\weapons.ini", g\name, "accuracy") * (Float(1) / AccuracyResult) Next CreateConsoleMsg("Accuracy multiplier set to " + AccuracyResult + "x") EndIf @@ -1458,7 +1458,7 @@ Function UpdateConsole(commandSet%) CreateConsoleMsg("You cannot have a rate of fire multiplier less than 0", 255, 0, 0) Else For g = Each Guns - g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") * RateOfFireResult + g\Rate_Of_Fire = GetINIFloat("Data\weapons.ini", g\name, "rate_of_fire") * (Float(1) / RateOfFireResult) Next CreateConsoleMsg("Rate of fire multiplier set to " + RateOfFireResult + "x") EndIf From 73aab58dfb249c7380933ee84a319a2339b21016 Mon Sep 17 00:00:00 2001 From: Hashim Qureshi Date: Sun, 19 Jun 2022 11:11:56 -0400 Subject: [PATCH 7/7] Small fixes (see desc.) - Sprint bar is color coded when setting stamina use multiplier now - Code indents were fixed from the GitHub conflict merge fix - Infinite stamina overrides the stamina effect in place and prevents modification of stamina use if it's on --- SourceCode/Console.bb | 22 +++++++++++++--------- SourceCode/GUI.bb | 14 +++++++------- SourceCode/Main.bb | 5 +++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/SourceCode/Console.bb b/SourceCode/Console.bb index 2596c8b..8d6e4eb 100644 --- a/SourceCode/Console.bb +++ b/SourceCode/Console.bb @@ -1354,18 +1354,22 @@ Function UpdateConsole(commandSet%) If StrTemp = "" Then CreateConsoleMsg("Too few parameters. Usage: setstaminamult (amount)", 255, 0, 0) Else - If Lower(StrTemp) = "default" Then - StaminaEffect = 1.0 - StaminaEffectTimer = 2147483647 - CreateConsoleMsg("Stamina use multiplier set to default") + If InfiniteStamina Then + CreateConsoleMsg("You cannot use this command if you have infinite stamina on!", 255, 0, 0) Else - StaminaEffect = Float(StrTemp) - If StaminaEffect < 0.0 Then + If Lower(StrTemp) = "default" Then StaminaEffect = 1.0 - CreateConsoleMsg("You cannot have a stamina use multiplier less than 0", 255, 0, 0) - Else StaminaEffectTimer = 2147483647 - CreateConsoleMsg("Stamina use multiplier set to " + StaminaEffect + "x") + CreateConsoleMsg("Stamina use multiplier set to default") + Else + StaminaEffect = Float(StrTemp) + If StaminaEffect < 0.0 Then + StaminaEffect = 1.0 + CreateConsoleMsg("You cannot have a stamina use multiplier less than 0", 255, 0, 0) + Else + StaminaEffectTimer = 2147483647 + CreateConsoleMsg("Stamina use multiplier set to " + StaminaEffect + "x") + EndIf EndIf EndIf EndIf diff --git a/SourceCode/GUI.bb b/SourceCode/GUI.bb index 056b61b..333375c 100644 --- a/SourceCode/GUI.bb +++ b/SourceCode/GUI.bb @@ -2345,8 +2345,8 @@ Function DrawGUI() Else If BlinkEffect < 1.0 Then Color 0, 255, 0 - Else If BlinkEffect > 1.0 Then - Color 255, 0, 0 + Else If BlinkEffect > 1.0 Then + Color 255, 0, 0 Else Color 255, 255, 255 EndIf @@ -2370,8 +2370,8 @@ Function DrawGUI() Else If BlinkEffect < 1.0 Then Color 0, 255, 0 - Else If BlinkEffect > 1.0 Then - Color 255, 0, 0 + Else If BlinkEffect > 1.0 Then + Color 255, 0, 0 Else Color 255, 255, 255 EndIf @@ -2433,7 +2433,7 @@ Function DrawGUI() If InfiniteStamina Or (StaminaEffect < 1.0) Then Color 0, 255, 0 Else - If Stamina <= 20.0 Then + If Stamina <= 20.0 Or StaminaEffect > 1.0 Then Color 255, 0, 0 Else Color 255, 255, 255 @@ -2452,8 +2452,8 @@ Function DrawGUI() Else If Stamina <= 0.0 Or Speed < 0.018 Then Color 255, 0, 0 - Else If Speed > 0.018 Then - Color 0, 255, 0 + Else If Speed > 0.018 Then + Color 0, 255, 0 Else Color 255, 255, 255 EndIf diff --git a/SourceCode/Main.bb b/SourceCode/Main.bb index 10684ee..0617d7e 100644 --- a/SourceCode/Main.bb +++ b/SourceCode/Main.bb @@ -2545,6 +2545,11 @@ Function MovePlayer() Stamina = Min(Stamina + 0.15 * FPSfactor*1.25, 100.0) EndIf + If InfiniteStamina Then + StaminaEffect = 1.0 + StaminaEffectTimer = 2147483647 + EndIf + If StaminaEffectTimer > 0 Then StaminaEffectTimer = StaminaEffectTimer - (FPSfactor/70) Else