diff --git a/Sprite-0002.aseprite b/Sprite-0002.aseprite index 54ac2c0..cfedf8e 100644 Binary files a/Sprite-0002.aseprite and b/Sprite-0002.aseprite differ diff --git a/sndinfo.txt b/sndinfo.txt new file mode 100644 index 0000000..41b9ea1 --- /dev/null +++ b/sndinfo.txt @@ -0,0 +1,2 @@ +kiri/gretchencounter_click "sounds/kirigretchencounter_click.ogg" +kiri/gretchencounter_blip "sounds/kirigretchencounter_blip.ogg" diff --git a/sounds/kirigretchencounter_blip.ogg b/sounds/kirigretchencounter_blip.ogg new file mode 100644 index 0000000..5478699 Binary files /dev/null and b/sounds/kirigretchencounter_blip.ogg differ diff --git a/sounds/kirigretchencounter_click.ogg b/sounds/kirigretchencounter_click.ogg new file mode 100644 index 0000000..049ca4d Binary files /dev/null and b/sounds/kirigretchencounter_click.ogg differ diff --git a/source_data/kirigretchencounter_blip.wav b/source_data/kirigretchencounter_blip.wav new file mode 100644 index 0000000..c814866 Binary files /dev/null and b/source_data/kirigretchencounter_blip.wav differ diff --git a/source_data/kirigretchencounter_click.wav b/source_data/kirigretchencounter_click.wav new file mode 100644 index 0000000..b2d1cbf Binary files /dev/null and b/source_data/kirigretchencounter_click.wav differ diff --git a/sprites/Sprite-0002.aseprite b/sprites/Sprite-0002.aseprite new file mode 100644 index 0000000..6b176a2 Binary files /dev/null and b/sprites/Sprite-0002.aseprite differ diff --git a/sprites/kgcma0.png b/sprites/kgcma0.png new file mode 100644 index 0000000..d4833c0 Binary files /dev/null and b/sprites/kgcma0.png differ diff --git a/sprites/kgcna0.png b/sprites/kgcna0.png new file mode 100644 index 0000000..319e80a Binary files /dev/null and b/sprites/kgcna0.png differ diff --git a/zscript.zs b/zscript.zs index 6abcaac..00eede0 100644 --- a/zscript.zs +++ b/zscript.zs @@ -25,6 +25,9 @@ class GretchenCounter : HDWeapon } float lastReading; + float angularVelocity; + float needlePosition; + int framesSinceLastBeep; override double WeaponBulk() { @@ -47,16 +50,22 @@ class GretchenCounter : HDWeapon SARG F -1; stop; + // Needle overlay states. + needle_indicator: + KGCN A 1; wait; + select0: - SARG F 1; + KGCM A 1; goto select0big; deselect0: - SARG F 1; + KGCM A 1; goto deselect0big; ready: - SARG F 1 { + KGCM A 1 { + A_Overlay(355, "needle_indicator"); + A_OverlayPivotAlign(355, PSPA_CENTER, PSPA_BOTTOM); UpdateDisplay(); A_WeaponReady(WRF_NOFIRE | WRF_ALLOWUSER3); // USER3 = MagManager. } @@ -94,8 +103,18 @@ class GretchenCounter : HDWeapon return totalReading; } + // override void Tick() + // { + // super.Tick(); + // UpdateDisplay(); + // } + action void UpdateDisplay() { + float angle_min = -45.0; + float angle_max = 45.0; + + // console.printf("kjsdcsjkdcnsdjkcnsdkjcnsdc"); // ThinkerIterator iter = ThinkerIterator.Create("BFGNecroShard"); @@ -124,9 +143,20 @@ class GretchenCounter : HDWeapon GetReadingForType("BFGNecroShard", 1.0) + GetReadingForType("HDBarrel", 2.0); - invoker.lastReading = totalReading * 0.01 + invoker.lastReading * 0.99; + // invoker.lastReading = totalReading * 0.01 + invoker.lastReading * 0.99; float pct_reading = invoker.lastReading * 2000.0; + + invoker.lastReading = totalReading; + + float r = frandom(0.0, 1.0); + if(r < pct_reading) + { + console.printf("test: %f %f", r, pct_reading); + A_StartSound("kiri/gretchencounter_click"); + } + + // if(pct_reading > 1.0) { // pct_reading = 1.0; // } @@ -142,7 +172,33 @@ class GretchenCounter : HDWeapon } } + // if(pct_reading > 1.0) { + // pct_reading = 1.0; + // } + // A_OverlayRotate(355, + // angle_min + (angle_max - angle_min) * (1.0 - pct_reading)); + + + invoker.angularvelocity += pct_reading - invoker.needlePosition; + invoker.angularvelocity *= 0.97; + + bool wasNeedleAtMax = (invoker.needlePosition >= 0.9); + + invoker.needlePosition += invoker.angularvelocity * 0.1; + invoker.needlePosition = clamp(invoker.needlePosition, 0.0, 1.0); + + A_OverlayRotate(355, + angle_min + (angle_max - angle_min) * (1.0 - invoker.needlePosition)); + + console.printf("Ang vel %f", invoker.angularvelocity); console.printf("Shard count: [%s] %f", meter_str, pct_reading); + + + invoker.framesSinceLastBeep++; + if((!wasNeedleAtMax || invoker.framesSinceLastBeep > 15) && invoker.needlePosition >= 0.9) { + A_StartSound("kiri/gretchencounter_blip"); + invoker.framesSinceLastBeep = 0; + } } }