Stream work.
This commit is contained in:
parent
2175871ada
commit
a169cba542
Binary file not shown.
6
TODO.md
Normal file
6
TODO.md
Normal file
@ -0,0 +1,6 @@
|
||||
x Makefile for building assets
|
||||
x On/Off switch
|
||||
- README file
|
||||
- Pickup sprites
|
||||
- Battery usage
|
||||
x Brightmaps
|
24
gldefs.txt
Normal file
24
gldefs.txt
Normal file
@ -0,0 +1,24 @@
|
||||
brightmap sprite kgcma0
|
||||
{
|
||||
map "sprites/bright_kgcma0.png"
|
||||
disablefullbright
|
||||
}
|
||||
|
||||
brightmap sprite kgcmb0
|
||||
{
|
||||
map "sprites/bright_kgcmb0.png"
|
||||
disablefullbright
|
||||
}
|
||||
|
||||
brightmap sprite kgcna0
|
||||
{
|
||||
map "sprites/bright_kgcma0.png"
|
||||
disablefullbright
|
||||
}
|
||||
|
||||
brightmap sprite kgcnb0
|
||||
{
|
||||
map "sprites/bright_kgcmb0.png"
|
||||
disablefullbright
|
||||
}
|
||||
|
Binary file not shown.
55
source_data/Makefile
Normal file
55
source_data/Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
all : \
|
||||
../sprites/kgcmb0.png \
|
||||
../sprites/kgcma0.png \
|
||||
../sprites/kgcna0.png \
|
||||
../sprites/kgcnb0.png \
|
||||
../sprites/bright_kgcma0.png \
|
||||
../sprites/bright_kgcmb0.png \
|
||||
../sounds/kirigretchencounter_click.ogg \
|
||||
../sounds/kirigretchencounter_blip.ogg
|
||||
|
||||
# Base frames
|
||||
../sprites/kgcma0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--ignore-layer "brightmap" \
|
||||
--frame-range 0,0 --save-as $@
|
||||
|
||||
../sprites/kgcmb0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--ignore-layer "brightmap" \
|
||||
--frame-range 1,1 --save-as $@
|
||||
|
||||
# Brightmaps
|
||||
../sprites/bright_kgcma0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--layer "brightmap" \
|
||||
--frame-range 0,0 --save-as $@
|
||||
|
||||
../sprites/bright_kgcmb0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--layer "brightmap" \
|
||||
--frame-range 1,1 --save-as $@
|
||||
|
||||
# Needle
|
||||
../sprites/kgcna0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--layer "needle" \
|
||||
--frame-range 0,0 --save-as $@
|
||||
|
||||
../sprites/kgcnb0.png : gretchencounter_weaponsprite.aseprite
|
||||
aseprite $^ \
|
||||
-b \
|
||||
--layer "needle" \
|
||||
--frame-range 1,1 --save-as $@
|
||||
|
||||
# Sounds
|
||||
../sounds/kirigretchencounter_click.ogg : kirigretchencounter_click.wav
|
||||
ffmpeg -i $^ "-filter:a" "volume=1.0" $@
|
||||
|
||||
../sounds/kirigretchencounter_blip.ogg : kirigretchencounter_blip.wav
|
||||
ffmpeg -i $^ "-filter:a" "volume=1.0" $@
|
BIN
source_data/gretchencounter_weaponsprite.aseprite
Normal file
BIN
source_data/gretchencounter_weaponsprite.aseprite
Normal file
Binary file not shown.
BIN
sprites/bright_kgcma0.png
Normal file
BIN
sprites/bright_kgcma0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
sprites/bright_kgcmb0.png
Normal file
BIN
sprites/bright_kgcmb0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
BIN
sprites/kgcmb0.png
Normal file
BIN
sprites/kgcmb0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
sprites/kgcnb0.png
Normal file
BIN
sprites/kgcnb0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
169
zscript.zs
169
zscript.zs
@ -28,6 +28,7 @@ class GretchenCounter : HDWeapon
|
||||
float angularVelocity;
|
||||
float needlePosition;
|
||||
int framesSinceLastBeep;
|
||||
bool onSwitch;
|
||||
|
||||
override double WeaponBulk()
|
||||
{
|
||||
@ -52,40 +53,94 @@ class GretchenCounter : HDWeapon
|
||||
|
||||
// Needle overlay states.
|
||||
needle_indicator:
|
||||
KGCN A 1; wait;
|
||||
KGCN # 1; wait;
|
||||
|
||||
select0:
|
||||
KGCM A 1;
|
||||
KGCM # 1 {
|
||||
updateOverlay();
|
||||
}
|
||||
goto select0big;
|
||||
|
||||
deselect0:
|
||||
KGCM A 1;
|
||||
KGCM # 1 {
|
||||
updateOverlay();
|
||||
}
|
||||
goto deselect0big;
|
||||
|
||||
ready:
|
||||
KGCM A 1 {
|
||||
KGCM B 1 {
|
||||
A_Overlay(355, "needle_indicator");
|
||||
A_OverlayPivotAlign(355, PSPA_CENTER, PSPA_BOTTOM);
|
||||
UpdateDisplay();
|
||||
A_WeaponReady(WRF_NOFIRE | WRF_ALLOWUSER3); // USER3 = MagManager.
|
||||
// invoker.UpdateDisplay();
|
||||
updateOverlay();
|
||||
|
||||
A_WeaponReady(WRF_ALLOWUSER3); // USER3 = MagManager.
|
||||
}
|
||||
|
||||
goto readyend;
|
||||
|
||||
fire:
|
||||
KGCM # 1 offset(0, 20) { updateOverlay(); }
|
||||
KGCM # 1 offset(0, 40) { updateOverlay(); }
|
||||
KGCM # 1 offset(0, 55) { updateOverlay(); }
|
||||
|
||||
KGCM # 1 {
|
||||
invoker.onSwitch = !invoker.onSwitch;
|
||||
console.printf("onswitch: %d", int(invoker.onSwitch));
|
||||
// TODO: Play sound.
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
KGCM # 1 offset(0, 55) { updateOverlay(); }
|
||||
KGCM # 1 offset(0, 40) { updateOverlay(); }
|
||||
KGCM # 1 offset(0, 20) { updateOverlay(); }
|
||||
KGCM # 1 offset(0, 0) { updateOverlay(); }
|
||||
goto waiting;
|
||||
|
||||
waiting:
|
||||
KGCM # 1 { updateOverlay(); }
|
||||
KGCM # 1 { updateOverlay(); }
|
||||
KGCM # 1 { updateOverlay(); }
|
||||
KGCM # 1 { updateOverlay(); }
|
||||
KGCM # 1 { updateOverlay(); }
|
||||
KGCM # 1 A_Refire("waiting");
|
||||
goto ready;
|
||||
|
||||
readyend:
|
||||
#### # 0 A_ReadyEnd();
|
||||
#### # 0 A_Jump(256,"ready");
|
||||
}
|
||||
|
||||
action float GetReadingForType(String type_name, float distance_scale)
|
||||
action void updateOverlay()
|
||||
{
|
||||
float angle_min = -45.0;
|
||||
float angle_max = 45.0;
|
||||
A_OverlayRotate(355,
|
||||
angle_min + (angle_max - angle_min) * (1.0 - invoker.needlePosition));
|
||||
|
||||
player.getpsprite(PSP_WEAPON).frame = int(invoker.onSwitch);
|
||||
player.getpsprite(355).frame = int(invoker.onSwitch);
|
||||
// frame = int(invoker.onSwitch);
|
||||
}
|
||||
|
||||
float GetReadingForType(String type_name, float distance_scale)
|
||||
{
|
||||
ThinkerIterator iter = ThinkerIterator.Create(type_name);
|
||||
Actor mo;
|
||||
float totalReading = 0.0;
|
||||
|
||||
Actor referenceActor = owner;
|
||||
if(!referenceActor) {
|
||||
referenceActor = self;
|
||||
}
|
||||
|
||||
while(mo = Actor(iter.Next()))
|
||||
{
|
||||
//shardCount++;
|
||||
float dist = Distance3D(mo);
|
||||
if(mo.health <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = referenceActor.Distance3D(mo);
|
||||
|
||||
// Convert to "meters" (with a minimum).
|
||||
if(dist < 32) {
|
||||
@ -96,26 +151,28 @@ class GretchenCounter : HDWeapon
|
||||
dist *= distance_scale;
|
||||
|
||||
|
||||
console.printf("%s", type_name);
|
||||
// console.printf("%s", type_name);
|
||||
totalReading += 1.0 / (dist * dist);
|
||||
}
|
||||
|
||||
return totalReading;
|
||||
}
|
||||
|
||||
// override void Tick()
|
||||
// {
|
||||
// super.Tick();
|
||||
// UpdateDisplay();
|
||||
// }
|
||||
|
||||
action void UpdateDisplay()
|
||||
override void Tick()
|
||||
{
|
||||
float angle_min = -45.0;
|
||||
float angle_max = 45.0;
|
||||
// console.printf("lsjksdjklcmsdlkmcsdlkmslckmlkmsdclkmsdclkmsdc");
|
||||
super.Tick();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void UpdateDisplay()
|
||||
{
|
||||
Actor referenceActor = owner;
|
||||
if(!referenceActor) {
|
||||
referenceActor = self;
|
||||
}
|
||||
|
||||
// console.printf("kjsdcsjkdcnsdjkcnsdkjcnsdc");
|
||||
console.printf("kjsdcsjkdcnsdjkcnsdkjcnsdc, %d", int(onSwitch));
|
||||
|
||||
// ThinkerIterator iter = ThinkerIterator.Create("BFGNecroShard");
|
||||
// Actor mo;
|
||||
@ -139,21 +196,24 @@ class GretchenCounter : HDWeapon
|
||||
// shardCount += 1;
|
||||
// }
|
||||
|
||||
float totalReading =
|
||||
GetReadingForType("BFGNecroShard", 1.0) +
|
||||
GetReadingForType("HDBarrel", 2.0);
|
||||
float totalReading = 0.0;
|
||||
if(onSwitch) {
|
||||
totalReading =
|
||||
GetReadingForType("BFGNecroShard", 1.0) +
|
||||
GetReadingForType("HDBarrel", 2.0);
|
||||
}
|
||||
|
||||
// invoker.lastReading = totalReading * 0.01 + invoker.lastReading * 0.99;
|
||||
// lastReading = totalReading * 0.01 + lastReading * 0.99;
|
||||
|
||||
float pct_reading = invoker.lastReading * 2000.0;
|
||||
float pct_reading = lastReading * 2000.0;
|
||||
|
||||
invoker.lastReading = totalReading;
|
||||
lastReading = totalReading;
|
||||
|
||||
float r = frandom(0.0, 1.0);
|
||||
if(r < pct_reading)
|
||||
if(r < pct_reading && onSwitch)
|
||||
{
|
||||
console.printf("test: %f %f", r, pct_reading);
|
||||
A_StartSound("kiri/gretchencounter_click");
|
||||
// console.printf("test: %f %f", r, pct_reading);
|
||||
referenceActor.A_StartSound("kiri/gretchencounter_click");
|
||||
}
|
||||
|
||||
|
||||
@ -162,15 +222,15 @@ class GretchenCounter : HDWeapon
|
||||
// }
|
||||
|
||||
|
||||
String meter_str = "";
|
||||
float k;
|
||||
for(k = 0.0; k < 1.0; k += 0.02) {
|
||||
if(k < pct_reading) {
|
||||
meter_str = meter_str.."#";
|
||||
} else {
|
||||
meter_str = meter_str.."_";
|
||||
}
|
||||
}
|
||||
// String meter_str = "";
|
||||
// float k;
|
||||
// for(k = 0.0; k < 1.0; k += 0.02) {
|
||||
// if(k < pct_reading) {
|
||||
// meter_str = meter_str.."#";
|
||||
// } else {
|
||||
// meter_str = meter_str.."_";
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(pct_reading > 1.0) {
|
||||
// pct_reading = 1.0;
|
||||
@ -179,25 +239,28 @@ class GretchenCounter : HDWeapon
|
||||
// angle_min + (angle_max - angle_min) * (1.0 - pct_reading));
|
||||
|
||||
|
||||
invoker.angularvelocity += pct_reading - invoker.needlePosition;
|
||||
invoker.angularvelocity *= 0.97;
|
||||
angularvelocity += pct_reading - needlePosition;
|
||||
angularvelocity *= 0.97;
|
||||
|
||||
bool wasNeedleAtMax = (invoker.needlePosition >= 0.9);
|
||||
bool wasNeedleAtMax = (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);
|
||||
needlePosition += angularvelocity * 0.1;
|
||||
needlePosition = clamp(needlePosition, 0.0, 1.0);
|
||||
|
||||
|
||||
invoker.framesSinceLastBeep++;
|
||||
if((!wasNeedleAtMax || invoker.framesSinceLastBeep > 15) && invoker.needlePosition >= 0.9) {
|
||||
A_StartSound("kiri/gretchencounter_blip");
|
||||
invoker.framesSinceLastBeep = 0;
|
||||
// console.printf("Ang vel %f", angularvelocity);
|
||||
// console.printf("Shard count: [%s] %f", meter_str, pct_reading);
|
||||
|
||||
|
||||
framesSinceLastBeep++;
|
||||
// if(onSwitch)
|
||||
{
|
||||
if(!wasNeedleAtMax || framesSinceLastBeep > 15) {
|
||||
if(needlePosition >= 0.9) {
|
||||
referenceActor.A_StartSound("kiri/gretchencounter_blip");
|
||||
framesSinceLastBeep = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user