From 982bd42f60155ee7c91dbb89d422fc1a6415f5bc Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sun, 24 Jan 2021 16:45:05 +0100 Subject: [PATCH] NEVERMIND I FIXED IT. --- Readme.md | 2 +- zscript/ammoled.zsc | 117 +++++++++++++++++++++++++++++++---------- zscript/eightball.zsc | 2 +- zscript/flakcannon.zsc | 2 +- zscript/minigun.zsc | 2 +- zscript/pulsegun.zsc | 2 +- 6 files changed, 93 insertions(+), 34 deletions(-) diff --git a/Readme.md b/Readme.md index 05770dc..e04df8a 100644 --- a/Readme.md +++ b/Readme.md @@ -58,7 +58,7 @@ This mod requires GZDoom 4.3 or later. - Hexen compatibility - Fancy titlemap - Semi-accurate UT sound behaviour - - Hacky cameratexture ammo counters for Pulsegun, Minigun, Flak Cannon and rocket launcher (TEMPORARILY DISABLED DUE TO A MAJOR BUG) + - Hacky cameratexture ammo counters for Pulsegun, Minigun, Flak Cannon and rocket launcher (may break) ## In progress diff --git a/zscript/ammoled.zsc b/zscript/ammoled.zsc index 8835425..4d0acd8 100644 --- a/zscript/ammoled.zsc +++ b/zscript/ammoled.zsc @@ -1,7 +1,7 @@ -const PULSELEDBASE = 60000; -const FLAKLEDBASE = 61000; -const MINILEDBASE = 62000; -const ROCKETLEDBASE = 63000; +const PULSELEDBASE = 60000.; +const FLAKLEDBASE = 61000.; +const MINILEDBASE = 62000.; +const ROCKETLEDBASE = 63000.; Class PulseGunLED : Actor { @@ -20,11 +20,30 @@ Class PulseGunLED : Actor override void PostBeginPlay() { - SetOrigin((PULSELEDBASE+64,128,99),false); - pitch = 90; - if ( !base ) base = Spawn("AmmoLEDScreen",(PULSELEDBASE+128,0,0)); - for ( int i=0; i<3; i++ ) if ( !digits[i] ) digits[i] = Spawn("LEDFont",(PULSELEDBASE+99,104+48*i,1)); - if ( !bar ) bar = Spawn("AmmoCountBar",(PULSELEDBASE+110,30,1)); + SetOrigin((PULSELEDBASE+128,0,0),false); + SetZ(floorz); + roll = 180; + angle = 180; + double stretch = level.pixelstretch; + double halfstretch = (1.+level.pixelstretch)/2.; + if ( !base ) + { + base = Spawn("AmmoLEDScreen",(PULSELEDBASE,-128.,floorz+64./halfstretch)); + base.scale.y /= level.pixelstretch; + } + for ( int i=0; i<3; i++ ) + { + if ( !digits[i] ) + { + digits[i] = Spawn("LEDFont",(PULSELEDBASE+1.,-72.+48.*i,floorz+50./halfstretch)); + digits[i].scale.y /= level.pixelstretch; + } + } + if ( !bar ) + { + bar = Spawn("AmmoCountBar",(PULSELEDBASE+1.,-98.,floorz-26./halfstretch)); + bar.scale.y /= level.pixelstretch; + } } override void Tick() { @@ -68,10 +87,25 @@ Class FlakCannonLED : Actor override void PostBeginPlay() { - SetOrigin((FLAKLEDBASE+32,64,45),false); - pitch = 90; - if ( !base ) base = Spawn("AmmoLEDScreen",(FLAKLEDBASE+64,0,0)); - for ( int i=0; i<3; i++ ) if ( !digits[i] ) digits[i] = Spawn("LEDFont",(FLAKLEDBASE+51,54+20*i,1)); + SetOrigin((FLAKLEDBASE+64,0,0),false); + SetZ(floorz); + roll = 180; + angle = 180; + double stretch = level.pixelstretch; + double halfstretch = (1.+level.pixelstretch)/2.; + if ( !base ) + { + base = Spawn("AmmoLEDScreen",(FLAKLEDBASE,-64.,floorz+32./halfstretch)); + base.scale.y /= level.pixelstretch; + } + for ( int i=0; i<3; i++ ) + { + if ( !digits[i] ) + { + digits[i] = Spawn("LEDFont",(FLAKLEDBASE+1.,-30.+20.*i,floorz+16./halfstretch)); + digits[i].scale.y /= level.pixelstretch; + } + } } override void Tick() { @@ -104,10 +138,25 @@ Class MinigunLED : Actor override void PostBeginPlay() { - SetOrigin((MINILEDBASE+32,32,18),false); - pitch = 90; - if ( !base ) base = Spawn("AmmoLEDScreen",(MINILEDBASE+64,0,0)); - for ( int i=0; i<3; i++ ) if ( !digits[i] ) digits[i] = Spawn("LEDFont",(MINILEDBASE+51,22+20*i,1)); + SetOrigin((MINILEDBASE+32,0,0),false); + SetZ(floorz); + roll = 180; + angle = 180; + double stretch = level.pixelstretch; + double halfstretch = (1.+level.pixelstretch)/2.; + if ( !base ) + { + base = Spawn("AmmoLEDScreen",(MINILEDBASE,-32.,floorz+32./halfstretch)); + base.scale.y /= level.pixelstretch; + } + for ( int i=0; i<3; i++ ) + { + if ( !digits[i] ) + { + digits[i] = Spawn("LEDFont",(MINILEDBASE+1.,-30.+20.*i,floorz+16./halfstretch)); + digits[i].scale.y /= level.pixelstretch; + } + } } override void Tick() { @@ -130,10 +179,25 @@ Class UTRocketLauncherLED : Actor override void PostBeginPlay() { - SetOrigin((ROCKETLEDBASE+32,32,18),false); - pitch = 90; - if ( !base ) base = Spawn("AmmoLEDScreen",(ROCKETLEDBASE+64,0,0)); - for ( int i=0; i<3; i++ ) if ( !digits[i] ) digits[i] = Spawn("LEDFont",(ROCKETLEDBASE+51,22+20*i,1)); + SetOrigin((ROCKETLEDBASE+32,0,0),false); + SetZ(floorz); + roll = 180; + angle = 180; + double stretch = level.pixelstretch; + double halfstretch = (1.+level.pixelstretch)/2.; + if ( !base ) + { + base = Spawn("AmmoLEDScreen",(ROCKETLEDBASE,-32.,floorz+32./halfstretch)); + base.scale.y /= level.pixelstretch; + } + for ( int i=0; i<3; i++ ) + { + if ( !digits[i] ) + { + digits[i] = Spawn("LEDFont",(ROCKETLEDBASE+1.,-30.+20.*i,floorz+16./halfstretch)); + digits[i].scale.y /= level.pixelstretch; + } + } } override void Tick() { @@ -162,8 +226,7 @@ Class LEDFont : Actor +NOGRAVITY; +NOINTERACTION; +DONTSPLASH; - +FLATSPRITE; - +YFLIP; // flatsprites™ + +WALLSPRITE; } States { @@ -186,9 +249,7 @@ Class AmmoCountBar : Actor +NOGRAVITY; +NOINTERACTION; +DONTSPLASH; - +FLATSPRITE; - +XFLIP; // flatsprites™ - +YFLIP; // flatsprites™ + +WALLSPRITE; } States { @@ -209,9 +270,7 @@ Class AmmoLEDScreen : Actor +NOGRAVITY; +NOINTERACTION; +DONTSPLASH; - +FLATSPRITE; - +XFLIP; // flatsprites™ - +YFLIP; // flatsprites™ + +WALLSPRITE; } States { diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index 56f007b..dd0206d 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -307,7 +307,7 @@ Class UTRocketLauncher : UTWeapon } if ( !Owner || !Owner.player || (Owner != players[consoleplayer].Camera) ) return; ammoled.mygun = self; - //TexMan.SetCameraToTexture(ammoled,"RAmmoLed",90); + TexMan.SetCameraToTexture(ammoled,"RAmmoLed",90); } override void PostBeginPlay() diff --git a/zscript/flakcannon.zsc b/zscript/flakcannon.zsc index 57138fd..ce69e3f 100644 --- a/zscript/flakcannon.zsc +++ b/zscript/flakcannon.zsc @@ -650,7 +650,7 @@ Class FlakCannon : UTWeapon } if ( !Owner || !Owner.player || (Owner != players[consoleplayer].Camera) ) return; ammoled.mygun = self; - //TexMan.SetCameraToTexture(ammoled,"FlakALed",90); + TexMan.SetCameraToTexture(ammoled,"FlakALed",90); } action void A_Loading( bool first = false ) diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc index 7a15dd1..6453b14 100644 --- a/zscript/minigun.zsc +++ b/zscript/minigun.zsc @@ -87,7 +87,7 @@ Class Minigun : UTWeapon } if ( !Owner || !Owner.player || (Owner != players[consoleplayer].Camera) ) return; ammoled.mygun = self; - //TexMan.SetCameraToTexture(ammoled,"MiniALed",90); + TexMan.SetCameraToTexture(ammoled,"MiniALed",90); } action void A_FireBullet( bool alt = false ) diff --git a/zscript/pulsegun.zsc b/zscript/pulsegun.zsc index 7b56cc8..3b82284 100644 --- a/zscript/pulsegun.zsc +++ b/zscript/pulsegun.zsc @@ -579,7 +579,7 @@ Class PulseGun : UTWeapon } if ( !Owner || !Owner.player || (Owner != players[consoleplayer].Camera) ) return; ammoled.mygun = self; - //TexMan.SetCameraToTexture(ammoled,"PAmmoLed",90); + TexMan.SetCameraToTexture(ammoled,"PAmmoLed",90); } override int, int, bool, bool GetClipAmount()