Pre-stream whatever.

This commit is contained in:
Kiri 2023-09-09 14:34:54 -07:00
parent 13a99783b3
commit c830efa728
12 changed files with 91 additions and 25 deletions

View File

@ -14,5 +14,8 @@
- ~~Caco plush sprite scaling~~ - ~~Caco plush sprite scaling~~
- ~~Frag counter in loadout starts with no battery~~ - ~~Frag counter in loadout starts with no battery~~
- ~~Organize source_data~~ - ~~Organize source_data~~
- ~~Spraycan spawn CVars~~
- ~~Spraycan bulk~~
- More spray patterns
- Loadout code descriptions (hdweapon.loadoutcodes) - Loadout code descriptions (hdweapon.loadoutcodes)

View File

@ -1,2 +1,2 @@
server int snektech_spawnflags = 3; server int snektech_spawnflags = 11;
user string snektech_spraypattern = "SnekSpray_TransPride"; user string snektech_spraypattern = "SnekSpray_TransPride";

View File

@ -10,5 +10,6 @@ OptionMenu "SnekTechMenu"
FlagOption "Gretchen Counter", "snektech_spawnflags", "YesNo", 0 FlagOption "Gretchen Counter", "snektech_spawnflags", "YesNo", 0
FlagOption "Wiring Bypass Kit", "snektech_spawnflags", "YesNo", 1 FlagOption "Wiring Bypass Kit", "snektech_spawnflags", "YesNo", 1
FlagOption "Cacodemon Plushie", "snektech_spawnflags", "YesNo", 2 FlagOption "Cacodemon Plushie", "snektech_spawnflags", "YesNo", 2
FlagOption "Spraypaint Can", "snektech_spawnflags", "YesNo", 3
} }

Binary file not shown.

Binary file not shown.

BIN
sprites/spraycan/kspra0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
sprites/spraycan/ksprb0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
sprites/spraycan/kspya0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
sprites/spraycan/kspyb0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -81,6 +81,11 @@ class SnekTechEventHandler : EventHandler
e.Thing, e.Thing,
SNEKTECH_CACOPLUSHIE, SNEKTECH_CACOPLUSHIE,
"KiriCacodemonPlushie"); "KiriCacodemonPlushie");
DoSnekTechBackpackSpawnCheck(
e.Thing,
SNEKTECH_SPRAYCAN,
"Sprayer");
} }
override void CheckReplacement(ReplaceEvent e) override void CheckReplacement(ReplaceEvent e)
@ -107,6 +112,8 @@ class SnekTechEventHandler : EventHandler
SNEKTECH_CACOPLUSHIE, SNEKTECH_CACOPLUSHIE,
"BlurSphere", "KiriCacodemonPlushie", "BlurSphere", "KiriCacodemonPlushie",
6, e); 6, e);
// Note: No replacements for spray cans.
} }
} }

View File

@ -1,5 +1,6 @@
// FIXME: Make consts and enums consistent formatting. // FIXME: Make consts and enums consistent formatting.
// FIXME: Add bulk.
const KIRI_SPRAY_DISTANCE = 96; const KIRI_SPRAY_DISTANCE = 96;
const KIRI_SPRAY_SHAKEANIM_MAXANGLE = 20.0; const KIRI_SPRAY_SHAKEANIM_MAXANGLE = 20.0;
@ -7,6 +8,7 @@ const KIRI_SPRAY_MAXPAINT = 50;
const KIRI_SPRAY_MAXPRESSURE = 100; const KIRI_SPRAY_MAXPRESSURE = 100;
const KIRI_SPRAY_PRESSUREBUILDSCALE = 20; const KIRI_SPRAY_PRESSUREBUILDSCALE = 20;
const KIRI_SPRAY_PRESSURE_PER_USE = (KIRI_SPRAY_MAXPRESSURE / 2); const KIRI_SPRAY_PRESSURE_PER_USE = (KIRI_SPRAY_MAXPRESSURE / 2);
const KIRI_SPRAY_PRESSURE_DECAY_RATE = 0.1;
const HDLD_KIRI_SPRAYCAN = "ksp"; const HDLD_KIRI_SPRAYCAN = "ksp";
@ -34,10 +36,13 @@ class Sprayer : HDWeapon
// inventory.icon "KSPRB0"; // inventory.icon "KSPRB0";
inventory.pickupsound "kiri/spraycan_rattle"; inventory.pickupsound "kiri/spraycan_rattle";
inventory.pickupmessage "Picked up some spraypaint cans."; inventory.pickupmessage "Picked up some spraypaint cans.";
// inventory.amount 1;
// inventory.maxamount 100; inventory.amount 1;
inventory.maxamount 100;
hdweapon.refid HDLD_KIRI_SPRAYCAN; hdweapon.refid HDLD_KIRI_SPRAYCAN;
tag "Spraypaint Can";
} }
states states
@ -67,22 +72,25 @@ class Sprayer : HDWeapon
// Taper off pressure increase amount based on how much // Taper off pressure increase amount based on how much
// pressure is in there already. // pressure is in there already.
float pressureIncreaseScale = 1.0 - ( float pressureIncreaseScale = 1.0 - (
float(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE]) / float(invoker.GetPressure()) /
float(KIRI_SPRAY_MAXPRESSURE)); float(KIRI_SPRAY_MAXPRESSURE));
pressureIncreaseScale *= pressureIncreaseScale; pressureIncreaseScale *= pressureIncreaseScale;
// Add pressure. // Add pressure.
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] += int pressure = invoker.GetPressure();
pressure +=
random(0, random(0,
KIRI_SPRAY_PRESSUREBUILDSCALE KIRI_SPRAY_PRESSUREBUILDSCALE
* invoker.weaponstatus[KIRI_SPRAY_WS_PAINT] * invoker.weaponstatus[KIRI_SPRAY_WS_PAINT]
/ KIRI_SPRAY_MAXPAINT); / KIRI_SPRAY_MAXPAINT);
// Cap pressure amount. // Cap pressure amount.
if(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] > KIRI_SPRAY_MAXPRESSURE) { if(pressure > KIRI_SPRAY_MAXPRESSURE) {
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] = KIRI_SPRAY_MAXPRESSURE; pressure = KIRI_SPRAY_MAXPRESSURE;
} }
invoker.SetPressure(pressure);
} }
KSPR A 1 offset(0, 60) { A_OverlayRotate(0, sin(level.time * 5.0) * KIRI_SPRAY_SHAKEANIM_MAXANGLE * 2.0/3.0); } KSPR A 1 offset(0, 60) { A_OverlayRotate(0, sin(level.time * 5.0) * KIRI_SPRAY_SHAKEANIM_MAXANGLE * 2.0/3.0); }
KSPR A 1 offset(0, 40) { A_OverlayRotate(0, sin(level.time * 5.0) * KIRI_SPRAY_SHAKEANIM_MAXANGLE * 1.0/3.0); } KSPR A 1 offset(0, 40) { A_OverlayRotate(0, sin(level.time * 5.0) * KIRI_SPRAY_SHAKEANIM_MAXANGLE * 1.0/3.0); }
@ -92,7 +100,7 @@ class Sprayer : HDWeapon
fire: fire:
KSPR A 2 { KSPR A 2 {
if(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] < KIRI_SPRAY_PRESSURE_PER_USE) { if(invoker.GetPressure() < KIRI_SPRAY_PRESSURE_PER_USE) {
invoker.owner.A_Log("Not enough pressure to spray."); invoker.owner.A_Log("Not enough pressure to spray.");
@ -151,7 +159,7 @@ class Sprayer : HDWeapon
spawner.actualDecalName = actualDecalName; spawner.actualDecalName = actualDecalName;
spawner.master = invoker.owner; spawner.master = invoker.owner;
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] -= KIRI_SPRAY_PRESSURE_PER_USE; invoker.SetPressure(invoker.GetPressure() - KIRI_SPRAY_PRESSURE_PER_USE);
invoker.weaponstatus[KIRI_SPRAY_WS_PAINT] -= 1; invoker.weaponstatus[KIRI_SPRAY_WS_PAINT] -= 1;
} }
@ -195,11 +203,66 @@ class Sprayer : HDWeapon
return GetSpareWeaponRegular(newowner, reverse, doselect); return GetSpareWeaponRegular(newowner, reverse, doselect);
} }
// Why do we store pressure as this weird equation?
//
// Pressure is stored as a time since the a hypothetical last
// "fully charged" time, based on the level time and pressure
// decay rate.
//
// This way we can decay pressure without ticking, important for
// spare weapons and stuff in backpacks.
int GetPressure() const
{
int time = level.TotalTime;
int lastChargedTime = weaponstatus[KIRI_SPRAY_WS_PRESSURE];
int pressure = int(
float(KIRI_SPRAY_MAXPRESSURE) -
float(time - lastChargedTime) * KIRI_SPRAY_PRESSURE_DECAY_RATE);
if(pressure > KIRI_SPRAY_MAXPRESSURE) {
pressure = KIRI_SPRAY_MAXPRESSURE;
}
if(pressure < 0) {
pressure = 0;
}
return pressure;
}
void SetPressure(int pressure)
{
if(pressure > KIRI_SPRAY_MAXPRESSURE) {
pressure = KIRI_SPRAY_MAXPRESSURE;
}
if(pressure < 0) {
pressure = 0;
}
int time = level.TotalTime;
int lastChargedTime = round(
float(pressure - KIRI_SPRAY_MAXPRESSURE) / float(KIRI_SPRAY_PRESSURE_DECAY_RATE) + time);
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = lastChargedTime;
}
void ResetPressure()
{
int resetValue = -int(float(KIRI_SPRAY_MAXPRESSURE) / float(KIRI_SPRAY_PRESSURE_DECAY_RATE));
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = resetValue;
}
override void Consolidate()
{
ResetPressure();
}
override void InitializeWepStats(bool idfa) override void InitializeWepStats(bool idfa)
{ {
super.InitializeWepStats(idfa); super.InitializeWepStats(idfa);
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = 0; SetPressure(0);
// Add a little bit of randomness to the amount of paint in // Add a little bit of randomness to the amount of paint in
// the can. // the can.
@ -208,26 +271,13 @@ class Sprayer : HDWeapon
- random(0, KIRI_SPRAY_MAXPAINT / 10); - random(0, KIRI_SPRAY_MAXPAINT / 10);
} }
override void Tick()
{
super.Tick();
// Gradually decay pressure.
if(random(0, 256) < 4) {
weaponstatus[KIRI_SPRAY_WS_PRESSURE] -= 1;
if(weaponstatus[KIRI_SPRAY_WS_PRESSURE] < 0) {
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = 0;
}
}
}
override void DrawHUDStuff( override void DrawHUDStuff(
HDStatusBar statusBar, HDWeapon weapon, HDStatusBar statusBar, HDWeapon weapon,
HDPlayerPawn pawn) HDPlayerPawn pawn)
{ {
// Current pressure (top bar). // Current pressure (top bar).
statusBar.DrawWepNum( statusBar.DrawWepNum(
weaponstatus[KIRI_SPRAY_WS_PRESSURE], GetPressure(),
KIRI_SPRAY_MAXPRESSURE, posy:-10); KIRI_SPRAY_MAXPRESSURE, posy:-10);
// Total paint remaining (bottom bar). // Total paint remaining (bottom bar).
@ -274,11 +324,16 @@ class Sprayer : HDWeapon
A_SetHelpText(); A_SetHelpText();
} }
override double WeaponBulk()
{
return 10;
}
override String GetHelpText() override String GetHelpText()
{ {
super.GetHelpText(); super.GetHelpText();
int messageIndex = level.time; //(level.time / 60); int messageIndex = level.time;
Array<String> messages = { Array<String> messages = {
"Deface the tyrant's property.", "Deface the tyrant's property.",
"Engage in civil disobedience.", "Engage in civil disobedience.",