diff --git a/Content/Metadata/Boss/Robot.res b/Content/Metadata/Boss/Robot.res
index 85b782d1..18d1e313 100644
--- a/Content/Metadata/Boss/Robot.res
+++ b/Content/Metadata/Boss/Robot.res
@@ -40,31 +40,40 @@
},
"Shrapnel1": {
- "Path": "Robot/shrapnel_1.aura"
+ "Path": "Robot/shrapnel_1.aura",
+ "States": [ 100 ]
},
"Shrapnel2": {
- "Path": "Robot/shrapnel_2.aura"
+ "Path": "Robot/shrapnel_2.aura",
+ "States": [ 101 ]
},
"Shrapnel3": {
- "Path": "Robot/shrapnel_3.aura"
+ "Path": "Robot/shrapnel_3.aura",
+ "States": [ 102 ]
},
"Shrapnel4": {
- "Path": "Robot/shrapnel_4.aura"
+ "Path": "Robot/shrapnel_4.aura",
+ "States": [ 103 ]
},
"Shrapnel5": {
- "Path": "Robot/shrapnel_5.aura"
+ "Path": "Robot/shrapnel_5.aura",
+ "States": [ 104 ]
},
"Shrapnel6": {
- "Path": "Robot/shrapnel_6.aura"
+ "Path": "Robot/shrapnel_6.aura",
+ "States": [ 105 ]
},
"Shrapnel7": {
- "Path": "Robot/shrapnel_7.aura"
+ "Path": "Robot/shrapnel_7.aura",
+ "States": [ 106 ]
},
"Shrapnel8": {
- "Path": "Robot/shrapnel_8.aura"
+ "Path": "Robot/shrapnel_8.aura",
+ "States": [ 107 ]
},
"Shrapnel9": {
- "Path": "Robot/shrapnel_9.aura"
+ "Path": "Robot/shrapnel_9.aura",
+ "States": [ 108 ]
}
},
diff --git a/Content/Metadata/Boss/TurtleBossShell.res b/Content/Metadata/Boss/TurtleBossShell.res
index 661a7ad1..202004ca 100644
--- a/Content/Metadata/Boss/TurtleBossShell.res
+++ b/Content/Metadata/Boss/TurtleBossShell.res
@@ -3,8 +3,7 @@
"Animations": {
"Idle": {
- "Path": "TurtleBoss/shell.aura",
- "States": [ 0 ]
+ "Path": "TurtleBoss/shell.aura"
}
},
diff --git a/Content/Metadata/Collectible/Coins.res b/Content/Metadata/Collectible/Coins.res
index c1d96ff2..8d8e2bc4 100644
--- a/Content/Metadata/Collectible/Coins.res
+++ b/Content/Metadata/Collectible/Coins.res
@@ -4,13 +4,15 @@
},
"Animations": {
- "CoinGold": {
- "Path": "Pickup/coin_gold.aura",
- "FrameRate": 5
- },
"CoinSilver": {
"Path": "Pickup/coin_silver.aura",
- "FrameRate": 5
+ "FrameRate": 5,
+ "States": [ 0 ]
+ },
+ "CoinGold": {
+ "Path": "Pickup/coin_gold.aura",
+ "FrameRate": 5,
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Collectible/Gems.res b/Content/Metadata/Collectible/Gems.res
index 15d6f4b0..89ba15c0 100644
--- a/Content/Metadata/Collectible/Gems.res
+++ b/Content/Metadata/Collectible/Gems.res
@@ -4,19 +4,23 @@
"Animations": {
"GemRed": {
"Path": "Pickup/gem.aura",
- "PaletteOffset": 128
+ "PaletteOffset": 128,
+ "States": [ 0 ]
},
"GemGreen": {
"Path": "Pickup/gem.aura",
- "PaletteOffset": 256
+ "PaletteOffset": 256,
+ "States": [ 1 ]
},
"GemBlue": {
"Path": "Pickup/gem.aura",
- "PaletteOffset": 384
+ "PaletteOffset": 384,
+ "States": [ 2 ]
},
"GemPurple": {
"Path": "Pickup/gem.aura",
- "PaletteOffset": 512
+ "PaletteOffset": 512,
+ "States": [ 3 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Common/Explosions.res b/Content/Metadata/Common/Explosions.res
index 3dab186d..12f048f8 100644
--- a/Content/Metadata/Common/Explosions.res
+++ b/Content/Metadata/Common/Explosions.res
@@ -4,72 +4,90 @@
},
"Animations": {
- "Large": {
- "Path": "Common/explosion_large.aura",
- "FrameRate": 8
+ "Tiny": {
+ "Path": "Common/explosion_tiny.aura",
+ "FrameRate": 13,
+ "States": [ 0 ]
},
- "Pepper": {
- "Path": "Common/explosion_pepper.aura"
+ "TinyBlue": {
+ "Path": "Common/explosion_freezer_maybe.aura",
+ "FrameRate": 13,
+ "States": [ 1 ]
},
- "RF": {
- "Path": "Common/explosion_rf.aura",
- "FrameRate": 6
+ "TinyDark": {
+ "Path": "Common/explosion_tiny_black.aura",
+ "FrameRate": 13,
+ "States": [ 2 ]
},
"Small": {
"Path": "Common/explosion_upwards.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 3 ]
},
"SmallDark": {
"Path": "Common/explosion_small.aura",
- "FrameRate": 8
- },
- "Tiny": {
- "Path": "Common/explosion_tiny.aura",
- "FrameRate": 13
- },
- "TinyBlue": {
- "Path": "Common/explosion_freezer_maybe.aura",
- "FrameRate": 13
+ "FrameRate": 8,
+ "States": [ 4 ]
},
- "TinyDark": {
- "Path": "Common/explosion_tiny_black.aura",
- "FrameRate": 13
+ "Large": {
+ "Path": "Common/explosion_large.aura",
+ "FrameRate": 8,
+ "States": [ 5 ]
},
"SmokeBrown": {
"Path": "Common/smoke_circling_brown.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 6 ]
},
"SmokeGray": {
"Path": "Common/smoke_circling_gray.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 7 ]
},
"SmokeWhite": {
"Path": "Common/smoke_circling_white.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 8 ]
},
"SmokePoof": {
"Path": "Common/smoke_poof.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 9 ]
},
"WaterSplash": {
"Path": "Common/water_splash.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 10 ]
+ },
+ "Pepper": {
+ "Path": "Common/explosion_pepper.aura",
+ "States": [ 11 ]
+ },
+ "RF": {
+ "Path": "Common/explosion_rf.aura",
+ "FrameRate": 6,
+ "States": [ 12 ]
},
"Generator": {
- "Path": "Common/generator.aura"
+ "Path": "Common/generator.aura",
+ "States": [ 13 ]
},
"IceShrapnel1": {
- "Path": "Common/ice_break_shrapnel_1.aura"
+ "Path": "Common/ice_break_shrapnel_1.aura",
+ "States": [ 14 ]
},
"IceShrapnel2": {
- "Path": "Common/ice_break_shrapnel_2.aura"
+ "Path": "Common/ice_break_shrapnel_2.aura",
+ "States": [ 15 ]
},
"IceShrapnel3": {
- "Path": "Common/ice_break_shrapnel_3.aura"
+ "Path": "Common/ice_break_shrapnel_3.aura",
+ "States": [ 16 ]
},
"IceShrapnel4": {
- "Path": "Common/ice_break_shrapnel_4.aura"
+ "Path": "Common/ice_break_shrapnel_4.aura",
+ "States": [ 17 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Common/Scenery.res b/Content/Metadata/Common/Scenery.res
index 833620dc..e759ba6b 100644
--- a/Content/Metadata/Common/Scenery.res
+++ b/Content/Metadata/Common/Scenery.res
@@ -3,10 +3,12 @@
"Animations": {
"Snow": {
- "Path": "Common/snow.aura"
+ "Path": "Common/snow.aura",
+ "States": [ 0 ]
},
"Rain": {
- "Path": "Common/rain.aura"
+ "Path": "Common/rain.aura",
+ "States": [ 1 ]
}
},
diff --git a/Content/Metadata/Enemy/Caterpillar.res b/Content/Metadata/Enemy/Caterpillar.res
index 10a2f82d..352e3830 100644
--- a/Content/Metadata/Enemy/Caterpillar.res
+++ b/Content/Metadata/Enemy/Caterpillar.res
@@ -36,7 +36,8 @@
"Smoke": {
"Path": "Caterpillar/smoke.aura",
- "FrameRate": 5
+ "FrameRate": 5,
+ "States": [ 7 ]
}
},
"Sounds": {
diff --git a/Content/Metadata/Enemy/LizardFloat.res b/Content/Metadata/Enemy/LizardFloat.res
index 58ee05cc..0793e18a 100644
--- a/Content/Metadata/Enemy/LizardFloat.res
+++ b/Content/Metadata/Enemy/LizardFloat.res
@@ -22,11 +22,13 @@
},
"Copter": {
"Path": "Lizard/copter.aura",
- "FrameRate": 20
+ "FrameRate": 20,
+ "States": [ 1 ]
},
"Bomb": {
- "Path": "Lizard/bomb.aura"
+ "Path": "Lizard/bomb.aura",
+ "States": [ 2 ]
}
},
diff --git a/Content/Metadata/Enemy/LizardFloatXmas.res b/Content/Metadata/Enemy/LizardFloatXmas.res
index 5fa0f324..af654943 100644
--- a/Content/Metadata/Enemy/LizardFloatXmas.res
+++ b/Content/Metadata/Enemy/LizardFloatXmas.res
@@ -22,12 +22,14 @@
},
"Copter": {
"Path": "Lizard/xmas_copter.aura",
- "FrameRate": 20
+ "FrameRate": 20,
+ "States": [ 1 ]
},
"Bomb": {
"Path": "Lizard/xmas_bomb.aura",
- "FrameRate": 8
+ "FrameRate": 8,
+ "States": [ 2 ]
}
},
diff --git a/Content/Metadata/Enemy/MadderHatter.res b/Content/Metadata/Enemy/MadderHatter.res
index 661acd72..53d04698 100644
--- a/Content/Metadata/Enemy/MadderHatter.res
+++ b/Content/Metadata/Enemy/MadderHatter.res
@@ -27,10 +27,12 @@
"States": [ 1073741826 ]
},
"Cup": {
- "Path": "MadderHatter/cup.aura"
+ "Path": "MadderHatter/cup.aura",
+ "States": [ 2 ]
},
"Hat": {
- "Path": "MadderHatter/hat.aura"
+ "Path": "MadderHatter/hat.aura",
+ "States": [ 3 ]
}
},
diff --git a/Content/Metadata/Enemy/Skeleton.res b/Content/Metadata/Enemy/Skeleton.res
index 22c873e5..786a3ee2 100644
--- a/Content/Metadata/Enemy/Skeleton.res
+++ b/Content/Metadata/Enemy/Skeleton.res
@@ -10,10 +10,12 @@
"States": [ 1 ]
},
"Bone": {
- "Path": "Skeleton/bone.aura"
+ "Path": "Skeleton/bone.aura",
+ "States": [ 2 ]
},
"Skull": {
- "Path": "Skeleton/skull.aura"
+ "Path": "Skeleton/skull.aura",
+ "States": [ 3 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Enemy/TurtleShell.res b/Content/Metadata/Enemy/TurtleShell.res
index 16d903e5..a9de4c1d 100644
--- a/Content/Metadata/Enemy/TurtleShell.res
+++ b/Content/Metadata/Enemy/TurtleShell.res
@@ -3,8 +3,7 @@
"Animations": {
"Idle": {
- "Path": "Turtle/shell_reverse.aura",
- "States": [ 0 ]
+ "Path": "Turtle/shell_reverse.aura"
}
},
diff --git a/Content/Metadata/Enemy/TurtleShellXmas.res b/Content/Metadata/Enemy/TurtleShellXmas.res
index 161c5ab4..f747af0c 100644
--- a/Content/Metadata/Enemy/TurtleShellXmas.res
+++ b/Content/Metadata/Enemy/TurtleShellXmas.res
@@ -3,8 +3,7 @@
"Animations": {
"Idle": {
- "Path": "Turtle/xmas_shell_reverse.aura",
- "States": [ 0 ]
+ "Path": "Turtle/xmas_shell_reverse.aura"
}
},
diff --git a/Content/Metadata/Interactive/PlayerFrog.res b/Content/Metadata/Interactive/PlayerFrog.res
index 8dfc3237..5efc730a 100644
--- a/Content/Metadata/Interactive/PlayerFrog.res
+++ b/Content/Metadata/Interactive/PlayerFrog.res
@@ -58,16 +58,20 @@
},
"Shield": {
- "Path": "Common/player_shield.aura"
+ "Path": "Common/player_shield.aura",
+ "States": [ 536870928 ]
},
"ShieldFire": {
- "Path": "Common/shield_fire.aura"
+ "Path": "Common/shield_fire.aura",
+ "States": [ 536870929 ]
},
"ShieldWater": {
- "Path": "Common/shield_water.aura"
+ "Path": "Common/shield_water.aura",
+ "States": [ 536870930 ]
},
"ShieldLightning": {
- "Path": "Common/shield_lightning.aura"
+ "Path": "Common/shield_lightning.aura",
+ "States": [ 536870931 ]
},
"TransformFromJazz": {
diff --git a/Content/Metadata/Interactive/PlayerJazz.res b/Content/Metadata/Interactive/PlayerJazz.res
index cb9da478..6c74e4c5 100644
--- a/Content/Metadata/Interactive/PlayerJazz.res
+++ b/Content/Metadata/Interactive/PlayerJazz.res
@@ -293,23 +293,28 @@
"IdleBored1": {
"Path": "Jazz/idle_flavor_1.aura",
- "FrameRate": 2
+ "FrameRate": 2,
+ "States": [ 536870944 ]
},
"IdleBored2": {
"Path": "Jazz/idle_flavor_2.aura",
- "FrameRate": 1
+ "FrameRate": 1,
+ "States": [ 536870945 ]
},
"IdleBored3": {
"Path": "Jazz/idle_flavor_3.aura",
- "FrameRate": 2
+ "FrameRate": 2,
+ "States": [ 536870946 ]
},
"IdleBored4": {
"Path": "Jazz/idle_flavor_4.aura",
- "FrameRate": 3
+ "FrameRate": 3,
+ "States": [ 536870947 ]
},
"IdleBored5": {
"Path": "Jazz/idle_flavor_5.aura",
- "FrameRate": 3
+ "FrameRate": 3,
+ "States": [ 536870948 ]
},
"TransformFromFrog": {
@@ -319,23 +324,29 @@
},
"Corpse": {
- "Path": "Jazz/corpse.aura"
+ "Path": "Jazz/corpse.aura",
+ "States": [ 536870912 ]
},
"SugarRush": {
- "Path": "Common/sugar_rush_stars.aura"
+ "Path": "Common/sugar_rush_stars.aura",
+ "States": [ 536870913 ]
},
"Shield": {
- "Path": "Common/player_shield.aura"
+ "Path": "Common/player_shield.aura",
+ "States": [ 536870928 ]
},
"ShieldFire": {
- "Path": "Common/shield_fire.aura"
+ "Path": "Common/shield_fire.aura",
+ "States": [ 536870929 ]
},
"ShieldWater": {
- "Path": "Common/shield_water.aura"
+ "Path": "Common/shield_water.aura",
+ "States": [ 536870930 ]
},
"ShieldLightning": {
- "Path": "Common/shield_lightning.aura"
+ "Path": "Common/shield_lightning.aura",
+ "States": [ 536870931 ]
}
},
diff --git a/Content/Metadata/Interactive/PlayerLori.res b/Content/Metadata/Interactive/PlayerLori.res
index 96a66c97..5b2bdb9e 100644
--- a/Content/Metadata/Interactive/PlayerLori.res
+++ b/Content/Metadata/Interactive/PlayerLori.res
@@ -289,15 +289,18 @@
"IdleBored1": {
"Path": "Lori/idle_flavor_2.aura",
- "FrameRate": 1
+ "FrameRate": 1,
+ "States": [ 536870944 ]
},
"IdleBored2": {
"Path": "Lori/idle_flavor_3.aura",
- "FrameRate": 3
+ "FrameRate": 3,
+ "States": [ 536870945 ]
},
"IdleBored3": {
"Path": "Lori/idle_flavor_4.aura",
- "FrameRate": 2
+ "FrameRate": 2,
+ "States": [ 536870946 ]
},
"TransformFromFrog": {
@@ -307,23 +310,29 @@
},
"Corpse": {
- "Path": "Lori/corpse.aura"
+ "Path": "Lori/corpse.aura",
+ "States": [ 536870912 ]
},
"SugarRush": {
- "Path": "Common/sugar_rush_stars.aura"
+ "Path": "Common/sugar_rush_stars.aura",
+ "States": [ 536870913 ]
},
"Shield": {
- "Path": "Common/player_shield.aura"
+ "Path": "Common/player_shield.aura",
+ "States": [ 536870928 ]
},
"ShieldFire": {
- "Path": "Common/shield_fire.aura"
+ "Path": "Common/shield_fire.aura",
+ "States": [ 536870929 ]
},
"ShieldWater": {
- "Path": "Common/shield_water.aura"
+ "Path": "Common/shield_water.aura",
+ "States": [ 536870930 ]
},
"ShieldLightning": {
- "Path": "Common/shield_lightning.aura"
+ "Path": "Common/shield_lightning.aura",
+ "States": [ 536870931 ]
}
},
diff --git a/Content/Metadata/Interactive/PlayerSpaz.res b/Content/Metadata/Interactive/PlayerSpaz.res
index b6f53816..955f6a23 100644
--- a/Content/Metadata/Interactive/PlayerSpaz.res
+++ b/Content/Metadata/Interactive/PlayerSpaz.res
@@ -290,19 +290,23 @@
"IdleBored1": {
"Path": "Spaz/idle_flavor_2.aura",
- "FrameRate": 2
+ "FrameRate": 2,
+ "States": [ 536870944 ]
},
"IdleBored2": {
"Path": "Spaz/idle_flavor_3.aura",
- "FrameRate": 1
+ "FrameRate": 1,
+ "States": [ 536870945 ]
},
"IdleBored3": {
"Path": "Spaz/idle_flavor_4.aura",
- "FrameRate": 3
+ "FrameRate": 3,
+ "States": [ 536870946 ]
},
"IdleBored4": {
"Path": "Spaz/idle_flavor_5.aura",
- "FrameRate": 3
+ "FrameRate": 3,
+ "States": [ 536870947 ]
},
"TransformFromFrog": {
@@ -312,23 +316,29 @@
},
"Corpse": {
- "Path": "Spaz/corpse.aura"
+ "Path": "Spaz/corpse.aura",
+ "States": [ 536870912 ]
},
"SugarRush": {
- "Path": "Common/sugar_rush_stars.aura"
+ "Path": "Common/sugar_rush_stars.aura",
+ "States": [ 536870913 ]
},
"Shield": {
- "Path": "Common/player_shield.aura"
+ "Path": "Common/player_shield.aura",
+ "States": [ 536870928 ]
},
"ShieldFire": {
- "Path": "Common/shield_fire.aura"
+ "Path": "Common/shield_fire.aura",
+ "States": [ 536870929 ]
},
"ShieldWater": {
- "Path": "Common/shield_water.aura"
+ "Path": "Common/shield_water.aura",
+ "States": [ 536870930 ]
},
"ShieldLightning": {
- "Path": "Common/shield_lightning.aura"
+ "Path": "Common/shield_lightning.aura",
+ "States": [ 536870931 ]
}
},
diff --git a/Content/Metadata/MovingPlatform/Ball.res b/Content/Metadata/MovingPlatform/Ball.res
index 9a2eb1c2..e82b0bee 100644
--- a/Content/Metadata/MovingPlatform/Ball.res
+++ b/Content/Metadata/MovingPlatform/Ball.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/ball.aura"
+ "Path": "Platform/ball.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/ball_chain.aura"
+ "Path": "Platform/ball_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/CarrotusFruit.res b/Content/Metadata/MovingPlatform/CarrotusFruit.res
index 9d5b0b33..a942fe87 100644
--- a/Content/Metadata/MovingPlatform/CarrotusFruit.res
+++ b/Content/Metadata/MovingPlatform/CarrotusFruit.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/carrotus_fruit.aura"
+ "Path": "Platform/carrotus_fruit.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/carrotus_fruit_chain.aura"
+ "Path": "Platform/carrotus_fruit_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/CarrotusGrass.res b/Content/Metadata/MovingPlatform/CarrotusGrass.res
index f61929dc..94035803 100644
--- a/Content/Metadata/MovingPlatform/CarrotusGrass.res
+++ b/Content/Metadata/MovingPlatform/CarrotusGrass.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/carrotus_grass.aura"
+ "Path": "Platform/carrotus_grass.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/carrotus_grass_chain.aura"
+ "Path": "Platform/carrotus_grass_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/Lab.res b/Content/Metadata/MovingPlatform/Lab.res
index 59390512..067c2a51 100644
--- a/Content/Metadata/MovingPlatform/Lab.res
+++ b/Content/Metadata/MovingPlatform/Lab.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/lab.aura"
+ "Path": "Platform/lab.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/lab_chain.aura"
+ "Path": "Platform/lab_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/Sonic.res b/Content/Metadata/MovingPlatform/Sonic.res
index daeee47a..718e5ceb 100644
--- a/Content/Metadata/MovingPlatform/Sonic.res
+++ b/Content/Metadata/MovingPlatform/Sonic.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/sonic.aura"
+ "Path": "Platform/sonic.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/sonic_chain.aura"
+ "Path": "Platform/sonic_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/Spike.res b/Content/Metadata/MovingPlatform/Spike.res
index 0c79d829..38af49d6 100644
--- a/Content/Metadata/MovingPlatform/Spike.res
+++ b/Content/Metadata/MovingPlatform/Spike.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Platform/spike.aura"
+ "Path": "Platform/spike.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Platform/spike_chain.aura"
+ "Path": "Platform/spike_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/MovingPlatform/SpikeBall.res b/Content/Metadata/MovingPlatform/SpikeBall.res
index 18327ae3..ed01b1ba 100644
--- a/Content/Metadata/MovingPlatform/SpikeBall.res
+++ b/Content/Metadata/MovingPlatform/SpikeBall.res
@@ -3,10 +3,12 @@
"Animations": {
"Platform": {
- "Path": "Object/3d_spike.aura"
+ "Path": "Object/3d_spike.aura",
+ "States": [ 0 ]
},
"Chain": {
- "Path": "Object/3d_spike_chain.aura"
+ "Path": "Object/3d_spike_chain.aura",
+ "States": [ 1 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Object/BarrelContainer.res b/Content/Metadata/Object/BarrelContainer.res
index 5f48fb8a..fe12e744 100644
--- a/Content/Metadata/Object/BarrelContainer.res
+++ b/Content/Metadata/Object/BarrelContainer.res
@@ -10,16 +10,20 @@
"States": [ 0 ]
},
"BarrelShrapnel1": {
- "Path": "Object/container_barrel_shrapnel_1.aura"
+ "Path": "Object/container_barrel_shrapnel_1.aura",
+ "States": [ 1 ]
},
"BarrelShrapnel2": {
- "Path": "Object/container_barrel_shrapnel_2.aura"
+ "Path": "Object/container_barrel_shrapnel_2.aura",
+ "States": [ 2 ]
},
"BarrelShrapnel3": {
- "Path": "Object/container_barrel_shrapnel_3.aura"
+ "Path": "Object/container_barrel_shrapnel_3.aura",
+ "States": [ 3 ]
},
"BarrelShrapnel4": {
- "Path": "Object/container_barrel_shrapnel_4.aura"
+ "Path": "Object/container_barrel_shrapnel_4.aura",
+ "States": [ 4 ]
}
},
diff --git a/Content/Metadata/Object/Bomb.res b/Content/Metadata/Object/Bomb.res
index 2b8ae4d6..9afee00b 100644
--- a/Content/Metadata/Object/Bomb.res
+++ b/Content/Metadata/Object/Bomb.res
@@ -3,7 +3,8 @@
"Animations": {
"Bomb": {
- "Path": "Common/bomb.aura"
+ "Path": "Common/bomb.aura",
+ "States": [ 2 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Object/BonusWarp.res b/Content/Metadata/Object/BonusWarp.res
index 723f0da9..295840e8 100644
--- a/Content/Metadata/Object/BonusWarp.res
+++ b/Content/Metadata/Object/BonusWarp.res
@@ -12,22 +12,22 @@
"Bonus10": {
"Path": "Object/bonus10.aura",
"FrameRate": 7,
- "States": [ 0 ]
+ "States": [ 10 ]
},
"Bonus20": {
"Path": "Object/bonus20.aura",
"FrameRate": 7,
- "States": [ 0 ]
+ "States": [ 20 ]
},
"Bonus50": {
"Path": "Object/bonus50.aura",
"FrameRate": 7,
- "States": [ 0 ]
+ "States": [ 50 ]
},
"Bonus100": {
"Path": "Object/bonus100.aura",
"FrameRate": 7,
- "States": [ 0 ]
+ "States": [ 100 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Checkpoint.res b/Content/Metadata/Object/Checkpoint.res
index d71b416b..d8ba4c3f 100644
--- a/Content/Metadata/Object/Checkpoint.res
+++ b/Content/Metadata/Object/Checkpoint.res
@@ -15,7 +15,7 @@
"FrameOffset": 13,
"FrameCount": 1,
"FrameRate": 0,
- "States": [ 0 ]
+ "States": [ 1 ]
},
"TransitionActivate": {
"Path": "Object/checkpoint.aura",
diff --git a/Content/Metadata/Object/CheckpointXmas.res b/Content/Metadata/Object/CheckpointXmas.res
index 2789b481..f12edafe 100644
--- a/Content/Metadata/Object/CheckpointXmas.res
+++ b/Content/Metadata/Object/CheckpointXmas.res
@@ -15,7 +15,7 @@
"FrameOffset": 13,
"FrameCount": 1,
"FrameRate": 0,
- "States": [ 0 ]
+ "States": [ 1 ]
},
"TransitionActivate": {
"Path": "Object/checkpoint_xmas.aura",
diff --git a/Content/Metadata/Object/Crate/AmmoBouncer.res b/Content/Metadata/Object/Crate/AmmoBouncer.res
new file mode 100644
index 00000000..32efd85e
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoBouncer.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoBouncer": {
+ "Path": "Object/crate_ammo_bouncer.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoElectro.res b/Content/Metadata/Object/Crate/AmmoElectro.res
new file mode 100644
index 00000000..b96065ac
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoElectro.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoElectro": {
+ "Path": "Object/crate_ammo_electro.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoFreezer.res b/Content/Metadata/Object/Crate/AmmoFreezer.res
new file mode 100644
index 00000000..64bb8a09
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoFreezer.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoFreezer": {
+ "Path": "Object/crate_ammo_freezer.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoPepper.res b/Content/Metadata/Object/Crate/AmmoPepper.res
new file mode 100644
index 00000000..f0f1a807
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoPepper.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoPepper": {
+ "Path": "Object/crate_ammo_pepper.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoRF.res b/Content/Metadata/Object/Crate/AmmoRF.res
new file mode 100644
index 00000000..9de24fb5
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoRF.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoRF": {
+ "Path": "Object/crate_ammo_rf.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoSeeker.res b/Content/Metadata/Object/Crate/AmmoSeeker.res
new file mode 100644
index 00000000..ae181238
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoSeeker.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoSeeker": {
+ "Path": "Object/crate_ammo_seeker.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoTNT.res b/Content/Metadata/Object/Crate/AmmoTNT.res
new file mode 100644
index 00000000..ea521ff4
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoTNT.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoTNT": {
+ "Path": "Object/crate_ammo_tnt.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/AmmoToaster.res b/Content/Metadata/Object/Crate/AmmoToaster.res
new file mode 100644
index 00000000..fc43013e
--- /dev/null
+++ b/Content/Metadata/Object/Crate/AmmoToaster.res
@@ -0,0 +1,28 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateAmmoToaster": {
+ "Path": "Object/crate_ammo_toaster.aura",
+ "States": [ 0 ]
+ },
+ "CrateAmmoShrapnel1": {
+ "Path": "Object/container_ammo_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateAmmoShrapnel2": {
+ "Path": "Object/container_ammo_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Crate/Generic.res b/Content/Metadata/Object/Crate/Generic.res
new file mode 100644
index 00000000..f7cdcfc8
--- /dev/null
+++ b/Content/Metadata/Object/Crate/Generic.res
@@ -0,0 +1,35 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "BoundingBox": [ 30, 28 ],
+
+ "Animations": {
+ "CrateGeneric": {
+ "Path": "Object/container_box_crush.aura",
+ "FrameCount": 1,
+ "FrameRate": 0,
+ "States": [ 0 ]
+ },
+ "CrateGenericCrush": {
+ "Path": "Object/container_box_crush.aura",
+ "FrameRate": 18,
+ "States": [ 1073741839 ]
+ },
+ "CrateShrapnel1": {
+ "Path": "Object/container_crate_shrapnel_1.aura",
+ "States": [ 1 ]
+ },
+ "CrateShrapnel2": {
+ "Path": "Object/container_crate_shrapnel_2.aura",
+ "States": [ 2 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/container_crate_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/CrateContainer.res b/Content/Metadata/Object/CrateContainer.res
deleted file mode 100644
index 9810cb3a..00000000
--- a/Content/Metadata/Object/CrateContainer.res
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "Version": {
- "Target": "Jazz² Resurrection"
- },
-
- "BoundingBox": [ 30, 28 ],
-
- "Animations": {
- "CrateGeneric": {
- "Path": "Object/container_box_crush.aura",
- "FrameCount": 1,
- "FrameRate": 0,
- "States": [ 0 ]
- },
- "CrateGenericCrush": {
- "Path": "Object/container_box_crush.aura",
- "FrameRate": 18,
- "States": [ 1073741839 ]
- },
- "CrateShrapnel1": {
- "Path": "Object/container_crate_shrapnel_1.aura"
- },
- "CrateShrapnel2": {
- "Path": "Object/container_crate_shrapnel_2.aura"
- },
- "CrateAmmoBouncer": {
- "Path": "Object/crate_ammo_bouncer.aura"
- },
- "CrateAmmoFreezer": {
- "Path": "Object/crate_ammo_freezer.aura"
- },
- "CrateAmmoSeeker": {
- "Path": "Object/crate_ammo_seeker.aura"
- },
- "CrateAmmoRF": {
- "Path": "Object/crate_ammo_rf.aura"
- },
- "CrateAmmoToaster": {
- "Path": "Object/crate_ammo_toaster.aura"
- },
- "CrateAmmoTNT": {
- "Path": "Object/crate_ammo_tnt.aura"
- },
- "CrateAmmoPepper": {
- "Path": "Object/crate_ammo_pepper.aura"
- },
- "CrateAmmoElectro": {
- "Path": "Object/crate_ammo_electro.aura"
- },
- "CrateAmmoShrapnel1": {
- "Path": "Object/container_ammo_shrapnel_1.aura"
- },
- "CrateAmmoShrapnel2": {
- "Path": "Object/container_ammo_shrapnel_2.aura"
- }
- },
-
- "Sounds": {
- "Break": {
- "Paths": [ "Object/container_crate_break.wav" ]
- }
- }
-}
\ No newline at end of file
diff --git a/Content/Metadata/Object/Moth.res b/Content/Metadata/Object/Moth.res
index bf020569..1d16baa6 100644
--- a/Content/Metadata/Object/Moth.res
+++ b/Content/Metadata/Object/Moth.res
@@ -4,21 +4,25 @@
},
"Animations": {
+ "Pink": {
+ "Path": "Moth/pink.aura",
+ "FrameRate": 40,
+ "States": [ 0 ]
+ },
"Gray": {
"Path": "Moth/gray.aura",
- "FrameRate": 40
+ "FrameRate": 40,
+ "States": [ 1 ]
},
"Green": {
"Path": "Moth/green.aura",
- "FrameRate": 40
- },
- "Pink": {
- "Path": "Moth/pink.aura",
- "FrameRate": 40
+ "FrameRate": 40,
+ "States": [ 2 ]
},
"Purple": {
"Path": "Moth/purple.aura",
- "FrameRate": 40
+ "FrameRate": 40,
+ "States": [ 3 ]
}
}
}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Bird.res b/Content/Metadata/Object/PowerUp/Bird.res
new file mode 100644
index 00000000..d2ac7358
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Bird.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Bird": {
+ "Path": "Object/powerup_transform_birdy.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Blaster.res b/Content/Metadata/Object/PowerUp/Blaster.res
new file mode 100644
index 00000000..3ef37696
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Blaster.res
@@ -0,0 +1,29 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "BlasterJazz": {
+ "Path": "Object/powerup_upgrade_blaster_jazz.aura",
+ "FrameRate": 6,
+ "States": [ 1 ]
+ },
+ "BlasterSpaz": {
+ "Path": "Object/powerup_upgrade_blaster_spaz.aura",
+ "FrameRate": 6,
+ "States": [ 2 ]
+ },
+ "BlasterLori": {
+ "Path": "Object/powerup_upgrade_blaster_lori.aura",
+ "FrameRate": 6,
+ "States": [ 3 ]
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Bouncer.res b/Content/Metadata/Object/PowerUp/Bouncer.res
new file mode 100644
index 00000000..113dcc7b
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Bouncer.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Bouncer": {
+ "Path": "Object/powerup_upgrade_bouncer.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Electro.res b/Content/Metadata/Object/PowerUp/Electro.res
new file mode 100644
index 00000000..3410a02d
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Electro.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Electro": {
+ "Path": "Object/powerup_upgrade_electro.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Empty.res b/Content/Metadata/Object/PowerUp/Empty.res
new file mode 100644
index 00000000..fbaaebca
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Empty.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Empty": {
+ "Path": "Object/powerup_empty.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Freezer.res b/Content/Metadata/Object/PowerUp/Freezer.res
new file mode 100644
index 00000000..f396d3b5
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Freezer.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Freezer": {
+ "Path": "Object/powerup_upgrade_freezer.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Pepper.res b/Content/Metadata/Object/PowerUp/Pepper.res
new file mode 100644
index 00000000..5d4ae0e2
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Pepper.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Pepper": {
+ "Path": "Object/powerup_upgrade_pepper.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/RF.res b/Content/Metadata/Object/PowerUp/RF.res
new file mode 100644
index 00000000..f0b6b6e4
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/RF.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "RF": {
+ "Path": "Object/powerup_upgrade_rf.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Seeker.res b/Content/Metadata/Object/PowerUp/Seeker.res
new file mode 100644
index 00000000..f8d8431c
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Seeker.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Seeker": {
+ "Path": "Object/powerup_upgrade_seeker.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/ShieldFire.res b/Content/Metadata/Object/PowerUp/ShieldFire.res
new file mode 100644
index 00000000..aab01c82
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/ShieldFire.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "ShieldFire": {
+ "Path": "Object/powerup_shield_fire.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/ShieldLaser.res b/Content/Metadata/Object/PowerUp/ShieldLaser.res
new file mode 100644
index 00000000..aa06a722
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/ShieldLaser.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "ShieldLaser": {
+ "Path": "Object/powerup_shield_laser.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/ShieldLightning.res b/Content/Metadata/Object/PowerUp/ShieldLightning.res
new file mode 100644
index 00000000..3fd393ad
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/ShieldLightning.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "ShieldLightning": {
+ "Path": "Object/powerup_shield_lightning.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/ShieldWater.res b/Content/Metadata/Object/PowerUp/ShieldWater.res
new file mode 100644
index 00000000..e831f030
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/ShieldWater.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "ShieldWater": {
+ "Path": "Object/powerup_shield_water.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Swap2.res b/Content/Metadata/Object/PowerUp/Swap2.res
new file mode 100644
index 00000000..eab77809
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Swap2.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Swap2": {
+ "Path": "Object/powerup_swap_characters.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Swap3.res b/Content/Metadata/Object/PowerUp/Swap3.res
new file mode 100644
index 00000000..732dee42
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Swap3.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Swap3": {
+ "Path": "Object/powerup_swap_characters_lori.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUp/Toaster.res b/Content/Metadata/Object/PowerUp/Toaster.res
new file mode 100644
index 00000000..a19c7084
--- /dev/null
+++ b/Content/Metadata/Object/PowerUp/Toaster.res
@@ -0,0 +1,18 @@
+{
+ "Version": {
+ "Target": "Jazz² Resurrection"
+ },
+
+ "Animations": {
+ "Toaster": {
+ "Path": "Object/powerup_upgrade_toaster.aura",
+ "FrameRate": 6
+ }
+ },
+
+ "Sounds": {
+ "Break": {
+ "Paths": [ "Object/powerup_break.wav" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUpMonitor.res b/Content/Metadata/Object/PowerUpMonitor.res
deleted file mode 100644
index 35a47bb6..00000000
--- a/Content/Metadata/Object/PowerUpMonitor.res
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "Version": {
- "Target": "Jazz² Resurrection"
- },
-
- "Animations": {
- "Empty": {
- "Path": "Object/powerup_empty.aura",
- "FrameRate": 6
- },
-
- "BlasterJazz": {
- "Path": "Object/powerup_upgrade_blaster_jazz.aura",
- "FrameRate": 6
- },
- "BlasterSpaz": {
- "Path": "Object/powerup_upgrade_blaster_spaz.aura",
- "FrameRate": 6
- },
- "BlasterLori": {
- "Path": "Object/powerup_upgrade_blaster_lori.aura",
- "FrameRate": 6
- },
-
- "Bouncer": {
- "Path": "Object/powerup_upgrade_bouncer.aura",
- "FrameRate": 6
- },
- "Freezer": {
- "Path": "Object/powerup_upgrade_freezer.aura",
- "FrameRate": 6
- },
- "Seeker": {
- "Path": "Object/powerup_upgrade_seeker.aura",
- "FrameRate": 6
- },
- "RF": {
- "Path": "Object/powerup_upgrade_rf.aura",
- "FrameRate": 6
- },
- "Toaster": {
- "Path": "Object/powerup_upgrade_toaster.aura",
- "FrameRate": 6
- },
- "TNT": {
- "Path": "Object/powerup_empty.aura",
- "FrameRate": 6
- },
- "Pepper": {
- "Path": "Object/powerup_upgrade_pepper.aura",
- "FrameRate": 6
- },
- "Electro": {
- "Path": "Object/powerup_upgrade_electro.aura",
- "FrameRate": 6
- },
-
- "Swap2": {
- "Path": "Object/powerup_swap_characters.aura",
- "FrameRate": 6
- },
- "Swap3": {
- "Path": "Object/powerup_swap_characters_lori.aura",
- "FrameRate": 6
- },
- "Bird": {
- "Path": "Object/powerup_transform_birdy.aura",
- "FrameRate": 6
- }
- },
-
- "Sounds": {
- "Break": {
- "Paths": [ "Object/powerup_break.wav" ]
- }
- }
-}
\ No newline at end of file
diff --git a/Content/Metadata/Object/PowerUpMonitorShield.res b/Content/Metadata/Object/PowerUpMonitorShield.res
deleted file mode 100644
index 7a707779..00000000
--- a/Content/Metadata/Object/PowerUpMonitorShield.res
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "Version": {
- "Target": "Jazz² Resurrection"
- },
-
- "Animations": {
- "Empty": {
- "Path": "Object/powerup_empty.aura",
- "FrameRate": 6
- },
-
- "ShieldFire": {
- "Path": "Object/powerup_shield_fire.aura",
- "FrameRate": 6
- },
- "ShieldWater": {
- "Path": "Object/powerup_shield_water.aura",
- "FrameRate": 6
- },
- "ShieldLightning": {
- "Path": "Object/powerup_shield_lightning.aura",
- "FrameRate": 6
- },
- "ShieldLaser": {
- "Path": "Object/powerup_shield_laser.aura",
- "FrameRate": 6
- }
- },
-
- "Sounds": {
- "Break": {
- "Paths": [ "Object/powerup_break.wav" ]
- }
- }
-}
\ No newline at end of file
diff --git a/Content/Metadata/Object/SwingingVine.res b/Content/Metadata/Object/SwingingVine.res
index 971577fe..9ef253c7 100644
--- a/Content/Metadata/Object/SwingingVine.res
+++ b/Content/Metadata/Object/SwingingVine.res
@@ -3,8 +3,7 @@
"Animations": {
"Vine": {
- "Path": "Object/vine.aura",
- "States": [ 0 ]
+ "Path": "Object/vine.aura"
}
}
}
\ No newline at end of file
diff --git a/Sources/Jazz2.vcxproj b/Sources/Jazz2.vcxproj
index 663ccc96..23dd99ab 100644
--- a/Sources/Jazz2.vcxproj
+++ b/Sources/Jazz2.vcxproj
@@ -598,6 +598,7 @@
+
diff --git a/Sources/Jazz2.vcxproj.filters b/Sources/Jazz2.vcxproj.filters
index 1284e19d..1121e96d 100644
--- a/Sources/Jazz2.vcxproj.filters
+++ b/Sources/Jazz2.vcxproj.filters
@@ -2261,6 +2261,9 @@
Source Files\Jazz2\UI\Menu
+
+ Source Files\Shared\IO
+
diff --git a/Sources/Jazz2/Actors/ActorBase.cpp b/Sources/Jazz2/Actors/ActorBase.cpp
index 3a327325..d7091460 100644
--- a/Sources/Jazz2/Actors/ActorBase.cpp
+++ b/Sources/Jazz2/Actors/ActorBase.cpp
@@ -413,13 +413,14 @@ namespace Jazz2::Actors
}
}
- void ActorBase::CreateSpriteDebris(const StringView& identifier, int count)
+ void ActorBase::CreateSpriteDebris(AnimState state, int count)
{
auto tilemap = _levelHandler->TileMap();
if (tilemap != nullptr && _metadata != nullptr) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView(identifier));
- if (it != _metadata->Graphics.end()) {
- tilemap->CreateSpriteDebris(&it->second, Vector3f(_pos.X, _pos.Y, (float)_renderer.layer()), count);
+ AnimationCandidate candidates[5];
+ if (FindAnimationCandidates(state, candidates) > 0) {
+ // TODO: Random
+ tilemap->CreateSpriteDebris(candidates[0].Resource, Vector3f(_pos.X, _pos.Y, (float)_renderer.layer()), count);
}
}
}
@@ -429,31 +430,12 @@ namespace Jazz2::Actors
auto it = _metadata->Sounds.find(String::nullTerminatedView(identifier));
if (it != _metadata->Sounds.end()) {
int idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int)it->second.Buffers.size()) : 0);
- return _levelHandler->PlaySfx(it->second.Buffers[idx].get(), Vector3f(_pos.X, _pos.Y, 0.0f), false, gain, pitch);
+ return _levelHandler->PlaySfx(&it->second.Buffers[idx]->Buffer, Vector3f(_pos.X, _pos.Y, 0.0f), false, gain, pitch);
} else {
return nullptr;
}
}
- void ActorBase::SetAnimation(const StringView& identifier)
- {
- if (_metadata == nullptr) {
- LOGE("No metadata loaded");
- return;
- }
-
- auto it = _metadata->Graphics.find(String::nullTerminatedView(identifier));
- if (it == _metadata->Graphics.end()) {
- LOGE("No animation found for \"%s\"", identifier.data());
- return;
- }
-
- _currentAnimation = &it->second;
- _currentAnimationState = AnimState::Idle;
-
- RefreshAnimation();
- }
-
bool ActorBase::SetAnimation(AnimState state)
{
if (_metadata == nullptr) {
@@ -496,66 +478,6 @@ namespace Jazz2::Actors
return true;
}
- bool ActorBase::SetTransition(const StringView& identifier, bool cancellable, const std::function& callback)
- {
- if (_metadata == nullptr) {
- return false;
- }
-
- auto it = _metadata->Graphics.find(String::nullTerminatedView(identifier));
- if (it == _metadata->Graphics.end()) {
- if (callback != nullptr) {
- callback();
- }
- return false;
- }
-
- if (_currentTransitionCallback != nullptr) {
- auto oldCallback = std::move(_currentTransitionCallback);
- _currentTransitionCallback = nullptr;
- oldCallback();
- }
-
- _currentTransition = &it->second;
- _currentTransitionState = AnimState::TransitionByName;
- _currentTransitionCancellable = cancellable;
- _currentTransitionCallback = callback;
-
- RefreshAnimation();
-
- return true;
- }
-
- bool ActorBase::SetTransition(const StringView& identifier, bool cancellable, std::function&& callback)
- {
- if (_metadata == nullptr) {
- return false;
- }
-
- auto it = _metadata->Graphics.find(String::nullTerminatedView(identifier));
- if (it == _metadata->Graphics.end()) {
- if (callback != nullptr) {
- callback();
- }
- return false;
- }
-
- if (_currentTransitionCallback != nullptr) {
- auto oldCallback = std::move(_currentTransitionCallback);
- _currentTransitionCallback = nullptr;
- oldCallback();
- }
-
- _currentTransition = &it->second;
- _currentTransitionState = AnimState::TransitionByName;
- _currentTransitionCancellable = cancellable;
- _currentTransitionCallback = std::move(callback);
-
- RefreshAnimation();
-
- return true;
- }
-
bool ActorBase::SetTransition(AnimState state, bool cancellable, const std::function& callback)
{
AnimationCandidate candidates[AnimationCandidatesCount];
@@ -1158,8 +1080,8 @@ namespace Jazz2::Actors
}
int i = 0;
- auto it = _metadata->Graphics.begin();
- while (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.begin();
+ while (it != _metadata->Animations.end()) {
if (i >= AnimationCandidatesCount) {
break;
}
diff --git a/Sources/Jazz2/Actors/ActorBase.h b/Sources/Jazz2/Actors/ActorBase.h
index 2fa702d5..84926f82 100644
--- a/Sources/Jazz2/Actors/ActorBase.h
+++ b/Sources/Jazz2/Actors/ActorBase.h
@@ -289,13 +289,10 @@ namespace Jazz2::Actors
void HandleFrozenStateChange(ActorBase* shot);
void CreateParticleDebris();
- void CreateSpriteDebris(const StringView& identifier, int count);
+ void CreateSpriteDebris(AnimState state, int count);
std::shared_ptr PlaySfx(const StringView& identifier, float gain = 1.0f, float pitch = 1.0f);
- void SetAnimation(const StringView& identifier);
bool SetAnimation(AnimState state);
- bool SetTransition(const StringView& identifier, bool cancellable, const std::function& callback = nullptr);
- bool SetTransition(const StringView& identifier, bool cancellable, std::function&& callback);
bool SetTransition(AnimState state, bool cancellable, const std::function& callback = nullptr);
bool SetTransition(AnimState state, bool cancellable, std::function&& callback);
void CancelTransition();
@@ -333,13 +330,12 @@ namespace Jazz2::Actors
}
void await_resume() { }
};
- return awaitable { this, path };
+ return awaitable{this, path};
}
#else
void RequestMetadataAsync(const StringView& path)
{
- auto metadata = ContentResolver::Get().RequestMetadata(path);
- _metadata = metadata;
+ _metadata = ContentResolver::Get().RequestMetadata(path);
}
#endif
@@ -358,9 +354,7 @@ namespace Jazz2::Actors
}
private:
- /// Deleted copy constructor
ActorBase(const ActorBase&) = delete;
- /// Deleted assignment operator
ActorBase& operator=(const ActorBase&) = delete;
ActorState _state;
diff --git a/Sources/Jazz2/Actors/Collectibles/AmmoCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/AmmoCollectible.cpp
index 48c09c59..faf0b493 100644
--- a/Sources/Jazz2/Actors/Collectibles/AmmoCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/AmmoCollectible.cpp
@@ -45,7 +45,7 @@ namespace Jazz2::Actors::Collectibles
case WeaponType::Thunderbolt: async_await RequestMetadataAsync("Collectible/AmmoThunderbolt"_s); break;
}
- SetAnimation("Ammo"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
diff --git a/Sources/Jazz2/Actors/Collectibles/CarrotCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/CarrotCollectible.cpp
index 978492f5..a30a7a8e 100644
--- a/Sources/Jazz2/Actors/Collectibles/CarrotCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/CarrotCollectible.cpp
@@ -24,7 +24,7 @@ namespace Jazz2::Actors::Collectibles
_scoreValue = 200;
async_await RequestMetadataAsync("Collectible/Carrot"_s);
}
- SetAnimation("Carrot"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Collectibles/CarrotFlyCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/CarrotFlyCollectible.cpp
index 15aefe3b..55601203 100644
--- a/Sources/Jazz2/Actors/Collectibles/CarrotFlyCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/CarrotFlyCollectible.cpp
@@ -15,7 +15,7 @@ namespace Jazz2::Actors::Collectibles
async_await RequestMetadataAsync("Collectible/CarrotFly"_s);
- SetAnimation("Carrot"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Collectibles/CarrotInvincibleCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/CarrotInvincibleCollectible.cpp
index ea6f888c..eb9a4bff 100644
--- a/Sources/Jazz2/Actors/Collectibles/CarrotInvincibleCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/CarrotInvincibleCollectible.cpp
@@ -17,7 +17,7 @@ namespace Jazz2::Actors::Collectibles
async_await RequestMetadataAsync("Collectible/CarrotInvincible"_s);
- SetAnimation("Carrot"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Collectibles/CoinCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/CoinCollectible.cpp
index 2675d703..40da78bc 100644
--- a/Sources/Jazz2/Actors/Collectibles/CoinCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/CoinCollectible.cpp
@@ -14,23 +14,20 @@ namespace Jazz2::Actors::Collectibles
async_await CollectibleBase::OnActivatedAsync(details);
uint8_t coinType = details.Params[0];
-
- async_await RequestMetadataAsync("Collectible/Coins"_s);
-
switch (coinType) {
default:
case 0: // Silver
_coinValue = 1;
_scoreValue = 500;
- SetAnimation("CoinSilver"_s);
break;
case 1: // Gold
_coinValue = 5;
_scoreValue = 1000;
- SetAnimation("CoinGold"_s);
break;
}
+ async_await RequestMetadataAsync("Collectible/Coins"_s);
+ SetAnimation((AnimState)coinType);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Collectibles/FastFireCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/FastFireCollectible.cpp
index 11b5dd26..1161214c 100644
--- a/Sources/Jazz2/Actors/Collectibles/FastFireCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/FastFireCollectible.cpp
@@ -28,7 +28,7 @@ namespace Jazz2::Actors::Collectibles
case PlayerType::Lori: async_await RequestMetadataAsync("Collectible/FastFireLori"_s); break;
}
- SetAnimation("FastFire"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
diff --git a/Sources/Jazz2/Actors/Collectibles/FoodCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/FoodCollectible.cpp
index bba8a1da..36f27b8e 100644
--- a/Sources/Jazz2/Actors/Collectibles/FoodCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/FoodCollectible.cpp
@@ -109,7 +109,7 @@ namespace Jazz2::Actors::Collectibles
break;
}
- SetAnimation("Food"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Collectibles/GemCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/GemCollectible.cpp
index def1f8e5..07a6900c 100644
--- a/Sources/Jazz2/Actors/Collectibles/GemCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/GemCollectible.cpp
@@ -21,22 +21,19 @@ namespace Jazz2::Actors::Collectibles
default:
case 0: // Red (+1)
_scoreValue = 100;
- SetAnimation("GemRed"_s);
break;
case 1: // Green (+5)
_scoreValue = 500;
- SetAnimation("GemGreen"_s);
break;
case 2: // Blue (+10)
_scoreValue = 1000;
- SetAnimation("GemBlue"_s);
break;
case 3: // Purple
_scoreValue = 100;
- SetAnimation("GemPurple"_s);
break;
}
+ SetAnimation((AnimState)_gemType);
SetFacingDirection();
_renderer.setAlphaF(0.7f);
diff --git a/Sources/Jazz2/Actors/Collectibles/GemGiant.cpp b/Sources/Jazz2/Actors/Collectibles/GemGiant.cpp
index 4ac41d63..2a5ecfcc 100644
--- a/Sources/Jazz2/Actors/Collectibles/GemGiant.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/GemGiant.cpp
@@ -25,7 +25,7 @@ namespace Jazz2::Actors::Collectibles
async_await RequestMetadataAsync("Object/GemGiant"_s);
- SetAnimation("GemGiant"_s);
+ SetAnimation(AnimState::Default);
_renderer.setAlphaF(0.7f);
diff --git a/Sources/Jazz2/Actors/Collectibles/GemRing.cpp b/Sources/Jazz2/Actors/Collectibles/GemRing.cpp
index e9d753bd..d3fbcd29 100644
--- a/Sources/Jazz2/Actors/Collectibles/GemRing.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/GemRing.cpp
@@ -93,8 +93,8 @@ namespace Jazz2::Actors::Collectibles
bool GemRing::OnDraw(RenderQueue& renderQueue)
{
if (!_pieces.empty()) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("GemRed"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("GemRed"_s));
+ if (it != _metadata->Animations.end()) {
auto& chainAnim = it->second;
Vector2i texSize = chainAnim.Base->TextureDiffuse->size();
diff --git a/Sources/Jazz2/Actors/Collectibles/OneUpCollectible.cpp b/Sources/Jazz2/Actors/Collectibles/OneUpCollectible.cpp
index 0a2dd2e9..1f83f292 100644
--- a/Sources/Jazz2/Actors/Collectibles/OneUpCollectible.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/OneUpCollectible.cpp
@@ -15,7 +15,7 @@ namespace Jazz2::Actors::Collectibles
async_await RequestMetadataAsync("Collectible/OneUp"_s);
- SetAnimation("OneUp"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Collectibles/Stopwatch.cpp b/Sources/Jazz2/Actors/Collectibles/Stopwatch.cpp
index facfdb31..02cb4456 100644
--- a/Sources/Jazz2/Actors/Collectibles/Stopwatch.cpp
+++ b/Sources/Jazz2/Actors/Collectibles/Stopwatch.cpp
@@ -15,7 +15,7 @@ namespace Jazz2::Actors::Collectibles
async_await RequestMetadataAsync("Collectible/Stopwatch"_s);
- SetAnimation("Stopwatch"_s);
+ SetAnimation(AnimState::Default);
SetFacingDirection();
async_return true;
diff --git a/Sources/Jazz2/Actors/Enemies/Bosses/Robot.cpp b/Sources/Jazz2/Actors/Enemies/Bosses/Robot.cpp
index 4238ce69..b85ac733 100644
--- a/Sources/Jazz2/Actors/Enemies/Bosses/Robot.cpp
+++ b/Sources/Jazz2/Actors/Enemies/Bosses/Robot.cpp
@@ -116,14 +116,9 @@ namespace Jazz2::Actors::Bosses
{
EnemyBase::OnHealthChanged(collider);
- constexpr StringView Shrapnels[] = {
- "Shrapnel1"_s, "Shrapnel2"_s, "Shrapnel3"_s,
- "Shrapnel4"_s, "Shrapnel5"_s, "Shrapnel6"_s,
- "Shrapnel7"_s, "Shrapnel8"_s, "Shrapnel9"_s
- };
- int n = Random().Next(1, 4);
- for (int i = 0; i < n; i++) {
- CreateSpriteDebris(Shrapnels[Random().Fast(0, countof(Shrapnels))], 1);
+ std::int32_t n = Random().Next(1, 4);
+ for (std::int32_t i = 0; i < n; i++) {
+ CreateSpriteDebris((AnimState)Random().Fast(100, 109), 1);
}
PlaySfx("Shrapnel"_s);
@@ -133,13 +128,8 @@ namespace Jazz2::Actors::Bosses
{
CreateParticleDebris();
- constexpr StringView Shrapnels[] = {
- "Shrapnel1"_s, "Shrapnel2"_s, "Shrapnel3"_s,
- "Shrapnel4"_s, "Shrapnel5"_s, "Shrapnel6"_s,
- "Shrapnel7"_s, "Shrapnel8"_s, "Shrapnel9"_s
- };
- for (int i = 0; i < 8; i++) {
- CreateSpriteDebris(Shrapnels[Random().Fast(0, countof(Shrapnels))], 1);
+ for (std::int32_t i = 0; i < 8; i++) {
+ CreateSpriteDebris((AnimState)Random().Fast(100, 109), 1);
}
_levelHandler->PlayCommonSfx("Splat"_s, Vector3f(_pos.X, _pos.Y, 0.0f));
diff --git a/Sources/Jazz2/Actors/Enemies/Caterpillar.cpp b/Sources/Jazz2/Actors/Enemies/Caterpillar.cpp
index 82b00c5c..f92676e3 100644
--- a/Sources/Jazz2/Actors/Enemies/Caterpillar.cpp
+++ b/Sources/Jazz2/Actors/Enemies/Caterpillar.cpp
@@ -129,7 +129,7 @@ namespace Jazz2::Actors::Enemies
_time = 500.0f;
async_await RequestMetadataAsync("Enemy/Caterpillar"_s);
- SetAnimation("Smoke"_s);
+ SetAnimation((AnimState)7);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Enemies/Dragon.cpp b/Sources/Jazz2/Actors/Enemies/Dragon.cpp
index 7ec777d0..ff0a63ec 100644
--- a/Sources/Jazz2/Actors/Enemies/Dragon.cpp
+++ b/Sources/Jazz2/Actors/Enemies/Dragon.cpp
@@ -136,7 +136,7 @@ namespace Jazz2::Actors::Enemies
SetFacingLeft(details.Params[0] != 0);
async_await RequestMetadataAsync("Weapon/Toaster"_s);
- SetAnimation("Fire"_s);
+ SetAnimation(AnimState::Default);
constexpr float BaseSpeed = 1.6f;
_speed.X = (IsFacingLeft() ? -1.0f : 1.0f) * (BaseSpeed + Random().NextFloat(0.0f, 0.2f));
diff --git a/Sources/Jazz2/Actors/Enemies/MadderHatter.cpp b/Sources/Jazz2/Actors/Enemies/MadderHatter.cpp
index dd499eb3..92de322e 100644
--- a/Sources/Jazz2/Actors/Enemies/MadderHatter.cpp
+++ b/Sources/Jazz2/Actors/Enemies/MadderHatter.cpp
@@ -108,8 +108,8 @@ namespace Jazz2::Actors::Enemies
_levelHandler->PlayCommonSfx("Splat"_s, Vector3f(_pos.X, _pos.Y, 0.0f));
if (_frozenTimeLeft <= 0.0f) {
- CreateSpriteDebris("Cup"_s, 1);
- CreateSpriteDebris("Hat"_s, 1);
+ CreateSpriteDebris((AnimState)2, 1); // Cup
+ CreateSpriteDebris((AnimState)3, 1); // Hat
}
TryGenerateRandomDrop();
diff --git a/Sources/Jazz2/Actors/Enemies/Skeleton.cpp b/Sources/Jazz2/Actors/Enemies/Skeleton.cpp
index 468bd955..83c24433 100644
--- a/Sources/Jazz2/Actors/Enemies/Skeleton.cpp
+++ b/Sources/Jazz2/Actors/Enemies/Skeleton.cpp
@@ -65,7 +65,7 @@ namespace Jazz2::Actors::Enemies
void Skeleton::OnHealthChanged(ActorBase* collider)
{
- CreateSpriteDebris("Bone"_s, Random().Next(1, 3));
+ CreateSpriteDebris((AnimState)2, Random().Next(1, 3)); // Bone
EnemyBase::OnHealthChanged(collider);
}
@@ -78,8 +78,8 @@ namespace Jazz2::Actors::Enemies
_levelHandler->PlayCommonSfx("Splat"_s, Vector3f(_pos.X, _pos.Y, 0.0f));
if (_frozenTimeLeft <= 0.0f) {
- CreateSpriteDebris("Skull"_s, 1);
- CreateSpriteDebris("Bone"_s, Random().Next(9, 12));
+ CreateSpriteDebris((AnimState)2, Random().Next(9, 12)); // Bone
+ CreateSpriteDebris((AnimState)2, 1); // Skull
}
TryGenerateRandomDrop();
diff --git a/Sources/Jazz2/Actors/Enemies/TurtleShell.cpp b/Sources/Jazz2/Actors/Enemies/TurtleShell.cpp
index f5442e30..3264ecd6 100644
--- a/Sources/Jazz2/Actors/Enemies/TurtleShell.cpp
+++ b/Sources/Jazz2/Actors/Enemies/TurtleShell.cpp
@@ -63,7 +63,7 @@ namespace Jazz2::Actors::Enemies
break;
}
- SetAnimation(AnimState::Idle);
+ SetAnimation(AnimState::Default);
_canHurtPlayer = false;
_friction = _levelHandler->Gravity * 0.05f;
diff --git a/Sources/Jazz2/Actors/Environment/AirboardGenerator.cpp b/Sources/Jazz2/Actors/Environment/AirboardGenerator.cpp
index db41fd92..f0ea033c 100644
--- a/Sources/Jazz2/Actors/Environment/AirboardGenerator.cpp
+++ b/Sources/Jazz2/Actors/Environment/AirboardGenerator.cpp
@@ -21,7 +21,7 @@ namespace Jazz2::Actors::Environment
async_await RequestMetadataAsync("Object/Airboard"_s);
- SetAnimation("Airboard"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Environment/AmbientBubbles.cpp b/Sources/Jazz2/Actors/Environment/AmbientBubbles.cpp
index 05b7e08b..4e61ab34 100644
--- a/Sources/Jazz2/Actors/Environment/AmbientBubbles.cpp
+++ b/Sources/Jazz2/Actors/Environment/AmbientBubbles.cpp
@@ -56,8 +56,8 @@ namespace Jazz2::Actors::Environment
auto tilemap = _levelHandler->TileMap();
if (tilemap != nullptr) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("AmbientBubbles"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("AmbientBubbles"_s));
+ if (it != _metadata->Animations.end()) {
Vector2i texSize = it->second.Base->TextureDiffuse->size();
Vector2i size = it->second.Base->FrameDimensions;
Vector2i frameConf = it->second.Base->FrameConfiguration;
diff --git a/Sources/Jazz2/Actors/Environment/Bomb.cpp b/Sources/Jazz2/Actors/Environment/Bomb.cpp
index 5616656b..2791ad70 100644
--- a/Sources/Jazz2/Actors/Environment/Bomb.cpp
+++ b/Sources/Jazz2/Actors/Environment/Bomb.cpp
@@ -37,7 +37,7 @@ namespace Jazz2::Actors::Environment
case 2: async_await RequestMetadataAsync("Enemy/LizardFloatXmas"_s); break;
}
- SetAnimation("Bomb"_s);
+ SetAnimation((AnimState)2);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Environment/BonusWarp.cpp b/Sources/Jazz2/Actors/Environment/BonusWarp.cpp
index e5e24986..9b6eae85 100644
--- a/Sources/Jazz2/Actors/Environment/BonusWarp.cpp
+++ b/Sources/Jazz2/Actors/Environment/BonusWarp.cpp
@@ -30,20 +30,14 @@ namespace Jazz2::Actors::Environment
switch (_cost) {
case 10:
- SetAnimation("Bonus10"_s);
- break;
case 20:
- SetAnimation("Bonus20"_s);
- break;
case 50:
- SetAnimation("Bonus50"_s);
- break;
case 100:
- SetAnimation("Bonus100"_s);
+ SetAnimation((AnimState)_cost);
break;
default:
// TODO: Show rabbit + coins needed, if (showAnim)
- SetAnimation("BonusGeneric"_s);
+ SetAnimation(AnimState::Default);
break;
}
diff --git a/Sources/Jazz2/Actors/Environment/Checkpoint.cpp b/Sources/Jazz2/Actors/Environment/Checkpoint.cpp
index 64cfa2ea..d8670375 100644
--- a/Sources/Jazz2/Actors/Environment/Checkpoint.cpp
+++ b/Sources/Jazz2/Actors/Environment/Checkpoint.cpp
@@ -37,13 +37,12 @@ namespace Jazz2::Actors::Environment
default:
async_await RequestMetadataAsync("Object/Checkpoint"_s);
break;
-
case 1: // Xmas
async_await RequestMetadataAsync("Object/CheckpointXmas"_s);
break;
}
- SetAnimation(_activated ? "Opened"_s : "Closed"_s);
+ SetAnimation((AnimState)(_activated ? 1 : 0));
if (GetState(ActorState::ApplyGravitation)) {
OnUpdateHitbox();
@@ -75,7 +74,7 @@ namespace Jazz2::Actors::Environment
if (auto player = dynamic_cast(other.get())) {
_activated = true;
- SetAnimation("Opened"_s);
+ SetAnimation((AnimState)1);
SetTransition(AnimState::TransitionActivate, false);
PlaySfx("TransitionActivate"_s);
diff --git a/Sources/Jazz2/Actors/Environment/Copter.cpp b/Sources/Jazz2/Actors/Environment/Copter.cpp
index d3c1ff5a..065b0307 100644
--- a/Sources/Jazz2/Actors/Environment/Copter.cpp
+++ b/Sources/Jazz2/Actors/Environment/Copter.cpp
@@ -27,7 +27,7 @@ namespace Jazz2::Actors::Environment
async_await RequestMetadataAsync("Enemy/LizardFloat"_s);
- SetAnimation("Copter"_s);
+ SetAnimation((AnimState)1);
_originPos = _pos;
diff --git a/Sources/Jazz2/Actors/Environment/EndOfLevel.cpp b/Sources/Jazz2/Actors/Environment/EndOfLevel.cpp
index 713cc6a6..12cb705f 100644
--- a/Sources/Jazz2/Actors/Environment/EndOfLevel.cpp
+++ b/Sources/Jazz2/Actors/Environment/EndOfLevel.cpp
@@ -18,7 +18,7 @@ namespace Jazz2::Actors::Environment
async_await RequestMetadataAsync("Object/SignEol"_s);
- SetAnimation("SignEol"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Environment/IceBlock.cpp b/Sources/Jazz2/Actors/Environment/IceBlock.cpp
index 53d4bdc1..ce1dc4e5 100644
--- a/Sources/Jazz2/Actors/Environment/IceBlock.cpp
+++ b/Sources/Jazz2/Actors/Environment/IceBlock.cpp
@@ -26,7 +26,7 @@ namespace Jazz2::Actors::Environment
SetState(ActorState::CanBeFrozen | ActorState::CollideWithTileset | ActorState::ApplyGravitation, false);
async_await RequestMetadataAsync("Object/IceBlock"_s);
- SetAnimation("IceBlock"_s);
+ SetAnimation(AnimState::Default);
_renderer.Initialize(ActorRendererType::FrozenMask);
diff --git a/Sources/Jazz2/Actors/Environment/Moth.cpp b/Sources/Jazz2/Actors/Environment/Moth.cpp
index f11be9d0..aee3b572 100644
--- a/Sources/Jazz2/Actors/Environment/Moth.cpp
+++ b/Sources/Jazz2/Actors/Environment/Moth.cpp
@@ -22,14 +22,7 @@ namespace Jazz2::Actors::Environment
uint8_t theme = details.Params[0];
async_await RequestMetadataAsync("Object/Moth"_s);
-
- switch (theme) {
- default:
- case 0: SetAnimation("Pink"_s); break;
- case 1: SetAnimation("Gray"_s); break;
- case 2: SetAnimation("Green"_s); break;
- case 3: SetAnimation("Purple"_s); break;
- }
+ SetAnimation((AnimState)theme);
_renderer.AnimPaused = true;
diff --git a/Sources/Jazz2/Actors/Environment/SteamNote.cpp b/Sources/Jazz2/Actors/Environment/SteamNote.cpp
index 4cc7b5f1..82bb7fab 100644
--- a/Sources/Jazz2/Actors/Environment/SteamNote.cpp
+++ b/Sources/Jazz2/Actors/Environment/SteamNote.cpp
@@ -19,7 +19,7 @@ namespace Jazz2::Actors::Environment
async_await RequestMetadataAsync("Object/SteamNote"_s);
- SetAnimation("SteamNote"_s);
+ SetAnimation(AnimState::Default);
PlaySfx("Appear"_s, 0.4f);
diff --git a/Sources/Jazz2/Actors/Environment/SwingingVine.cpp b/Sources/Jazz2/Actors/Environment/SwingingVine.cpp
index d970ead5..0dc749ca 100644
--- a/Sources/Jazz2/Actors/Environment/SwingingVine.cpp
+++ b/Sources/Jazz2/Actors/Environment/SwingingVine.cpp
@@ -32,7 +32,7 @@ namespace Jazz2::Actors::Environment
async_await RequestMetadataAsync("Object/SwingingVine"_s);
- SetAnimation("Vine"_s);
+ SetAnimation(AnimState::Default);
_renderer.AnimPaused = true;
diff --git a/Sources/Jazz2/Actors/Explosion.cpp b/Sources/Jazz2/Actors/Explosion.cpp
index 07ae1cb6..4008c12c 100644
--- a/Sources/Jazz2/Actors/Explosion.cpp
+++ b/Sources/Jazz2/Actors/Explosion.cpp
@@ -36,32 +36,19 @@ namespace Jazz2::Actors
async_await RequestMetadataAsync("Common/Explosions"_s);
+ // IceShrapnels are randomized below
+ if (_type != Type::IceShrapnel) {
+ SetAnimation((AnimState)_type);
+ }
+
switch (_type) {
- default:
- case Type::Tiny: SetAnimation("Tiny"_s); break;
- case Type::TinyBlue: SetAnimation("TinyBlue"_s); break;
- case Type::TinyDark: SetAnimation("TinyDark"_s); break;
- case Type::Small: SetAnimation("Small"_s); break;
- case Type::SmallDark: SetAnimation("SmallDark"_s); break;
case Type::Large: {
- SetAnimation("Large"_s);
-
_lightIntensity = 0.8f;
_lightBrightness = 0.9f;
_lightRadiusFar = 55.0f;
break;
}
-
- case Type::SmokeBrown: SetAnimation("SmokeBrown"_s); break;
- case Type::SmokeGray: SetAnimation("SmokeGray"_s); break;
- case Type::SmokeWhite: SetAnimation("SmokeWhite"_s); break;
- case Type::SmokePoof: SetAnimation("SmokePoof"_s); break;
-
- case Type::WaterSplash: SetAnimation("WaterSplash"_s); break;
-
case Type::Pepper: {
- SetAnimation("Pepper"_s);
-
_lightIntensity = 0.5f;
_lightBrightness = 0.2f;
_lightRadiusNear = 7.0f;
@@ -69,18 +56,13 @@ namespace Jazz2::Actors
break;
}
case Type::RF: {
- SetAnimation("RF"_s);
-
_lightIntensity = 0.8f;
_lightBrightness = 0.9f;
_lightRadiusFar = 50.0f;
break;
}
case Type::IceShrapnel: {
- constexpr StringView IceShrapnels[] = {
- "IceShrapnel1"_s, "IceShrapnel2"_s, "IceShrapnel3"_s, "IceShrapnel4"_s
- };
- SetAnimation(IceShrapnels[Random().Fast(0, countof(IceShrapnels))]);
+ SetAnimation((AnimState)((std::uint32_t)Type::IceShrapnel + Random().Fast(0, 4)));
SetState(ActorState::CollideWithTileset | ActorState::ApplyGravitation | ActorState::SkipPerPixelCollisions, true);
SetState(ActorState::ForceDisableCollisions, false);
@@ -95,10 +77,7 @@ namespace Jazz2::Actors
SetFacingLeft(_speed.X < 0.0f);
break;
}
-
case Type::Generator: {
- SetAnimation("Generator"_s);
-
// Apply random orientation
_renderer.setRotation(Random().NextFloat(0.0f, 4.0f * fPiOver2));
SetFacingLeft(Random().NextFloat() < 0.5f);
diff --git a/Sources/Jazz2/Actors/Explosion.h b/Sources/Jazz2/Actors/Explosion.h
index 2a3ac354..0e0418c9 100644
--- a/Sources/Jazz2/Actors/Explosion.h
+++ b/Sources/Jazz2/Actors/Explosion.h
@@ -8,26 +8,26 @@ namespace Jazz2::Actors
{
public:
enum class Type {
- Tiny = 0,
- TinyBlue = 1,
- TinyDark = 2,
- Small = 3,
- SmallDark = 4,
- Large = 5,
+ Tiny,
+ TinyBlue,
+ TinyDark,
+ Small,
+ SmallDark,
+ Large,
- SmokeBrown = 6,
- SmokeGray = 7,
- SmokeWhite = 8,
- SmokePoof = 9,
+ SmokeBrown,
+ SmokeGray,
+ SmokeWhite,
+ SmokePoof,
- WaterSplash = 10,
+ WaterSplash,
- Pepper = 11,
- RF = 12,
+ Pepper,
+ RF,
- IceShrapnel = 13,
+ Generator,
- Generator = 20,
+ IceShrapnel,
};
Explosion();
diff --git a/Sources/Jazz2/Actors/Player.cpp b/Sources/Jazz2/Actors/Player.cpp
index 103f6ce6..fb82f159 100644
--- a/Sources/Jazz2/Actors/Player.cpp
+++ b/Sources/Jazz2/Actors/Player.cpp
@@ -291,8 +291,8 @@ namespace Jazz2::Actors
auto tilemap = _levelHandler->TileMap();
if (tilemap != nullptr) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("Shield"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("Shield"_s));
+ if (it != _metadata->Animations.end()) {
Vector2i texSize = it->second.Base->TextureDiffuse->size();
Vector2i size = it->second.Base->FrameDimensions;
@@ -438,8 +438,8 @@ namespace Jazz2::Actors
auto tilemap = _levelHandler->TileMap();
if (tilemap != nullptr) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("SugarRush"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("SugarRush"_s));
+ if (it != _metadata->Animations.end()) {
Vector2i texSize = it->second.Base->TextureDiffuse->size();
Vector2i size = it->second.Base->FrameDimensions;
Vector2i frameConf = it->second.Base->FrameConfiguration;
@@ -972,8 +972,8 @@ namespace Jazz2::Actors
{
switch (_activeShield) {
case ShieldType::Fire: {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("ShieldFire"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("ShieldFire"_s));
+ if (it != _metadata->Animations.end()) {
float shieldAlpha = std::min(_activeShieldTime * 0.01f, 1.0f);
float shieldScale = std::min(_activeShieldTime * 0.016f + 0.6f, 1.0f);
@@ -1043,8 +1043,8 @@ namespace Jazz2::Actors
break;
}
case ShieldType::Water: {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("ShieldWater"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("ShieldWater"_s));
+ if (it != _metadata->Animations.end()) {
float shieldAlpha = std::min(_activeShieldTime * 0.01f, 1.0f);
float shieldScale = std::min(_activeShieldTime * 0.016f + 0.6f, 1.0f);
@@ -1090,8 +1090,8 @@ namespace Jazz2::Actors
break;
}
case ShieldType::Lightning: {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("ShieldLightning"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("ShieldLightning"_s));
+ if (it != _metadata->Animations.end()) {
float shieldAlpha = std::min(_activeShieldTime * 0.01f, 1.0f);
float shieldScale = std::min(_activeShieldTime * 0.016f + 0.6f, 1.0f);
@@ -1615,7 +1615,7 @@ namespace Jazz2::Actors
constexpr StringView IdleBored[] = {
"IdleBored1"_s, "IdleBored2"_s, "IdleBored3"_s, "IdleBored4"_s, "IdleBored5"_s
};
- int maxIdx;
+ std::int32_t maxIdx;
switch (_playerType) {
case PlayerType::Jazz: maxIdx = 5; break;
case PlayerType::Spaz: maxIdx = 4; break;
@@ -1623,8 +1623,8 @@ namespace Jazz2::Actors
default: maxIdx = 0; break;
}
if (maxIdx > 0) {
- int selectedIdx = Random().Fast(0, maxIdx);
- if (SetTransition(IdleBored[selectedIdx], true)) {
+ std::int32_t selectedIdx = Random().Fast(0, maxIdx);
+ if (SetTransition((AnimState)(536870944 + selectedIdx), true)) {
PlaySfx(IdleBored[selectedIdx]);
}
}
@@ -2230,7 +2230,7 @@ namespace Jazz2::Actors
auto it = _metadata->Sounds.find(String::nullTerminatedView(identifier));
if (it != _metadata->Sounds.end()) {
int idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int)it->second.Buffers.size()) : 0);
- return _levelHandler->PlaySfx(it->second.Buffers[idx].get(), Vector3f(0.0f, 0.0f, 0.0f), true, gain, pitch);
+ return _levelHandler->PlaySfx(&it->second.Buffers[idx]->Buffer, Vector3f(0.0f, 0.0f, 0.0f), true, gain, pitch);
} else {
return nullptr;
}
diff --git a/Sources/Jazz2/Actors/PlayerCorpse.cpp b/Sources/Jazz2/Actors/PlayerCorpse.cpp
index adc5c304..990fb197 100644
--- a/Sources/Jazz2/Actors/PlayerCorpse.cpp
+++ b/Sources/Jazz2/Actors/PlayerCorpse.cpp
@@ -28,7 +28,7 @@ namespace Jazz2::Actors
break;
}
- SetAnimation("Corpse"_s);
+ SetAnimation((AnimState)536870912);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Solid/AmmoBarrel.cpp b/Sources/Jazz2/Actors/Solid/AmmoBarrel.cpp
index 1f388bd4..12a21439 100644
--- a/Sources/Jazz2/Actors/Solid/AmmoBarrel.cpp
+++ b/Sources/Jazz2/Actors/Solid/AmmoBarrel.cpp
@@ -93,10 +93,10 @@ namespace Jazz2::Actors::Solid
CreateParticleDebris();
- CreateSpriteDebris("BarrelShrapnel1"_s, 3);
- CreateSpriteDebris("BarrelShrapnel2"_s, 3);
- CreateSpriteDebris("BarrelShrapnel3"_s, 2);
- CreateSpriteDebris("BarrelShrapnel4"_s, 1);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 3);
+ CreateSpriteDebris((AnimState)3, 2);
+ CreateSpriteDebris((AnimState)4, 1);
return GenericContainer::OnPerish(collider);
}
diff --git a/Sources/Jazz2/Actors/Solid/AmmoCrate.cpp b/Sources/Jazz2/Actors/Solid/AmmoCrate.cpp
index 85992b84..d073ba55 100644
--- a/Sources/Jazz2/Actors/Solid/AmmoCrate.cpp
+++ b/Sources/Jazz2/Actors/Solid/AmmoCrate.cpp
@@ -15,7 +15,19 @@ namespace Jazz2::Actors::Solid
void AmmoCrate::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/CrateContainer"_s);
+ WeaponType weaponType = (WeaponType)details.Params[0];
+ switch (weaponType) {
+ case WeaponType::Bouncer: PreloadMetadataAsync("Object/Crate/AmmoBouncer"_s); break;
+ case WeaponType::Freezer: PreloadMetadataAsync("Object/Crate/AmmoFreezer"_s); break;
+ case WeaponType::Seeker: PreloadMetadataAsync("Object/Crate/AmmoSeeker"_s); break;
+ case WeaponType::RF: PreloadMetadataAsync("Object/Crate/AmmoRF"_s); break;
+ case WeaponType::Toaster: PreloadMetadataAsync("Object/Crate/AmmoToaster"_s); break;
+ case WeaponType::TNT: PreloadMetadataAsync("Object/Crate/AmmoTNT"_s); break;
+ case WeaponType::Pepper: PreloadMetadataAsync("Object/Crate/AmmoPepper"_s); break;
+ case WeaponType::Electro: PreloadMetadataAsync("Object/Crate/AmmoElectro"_s); break;
+ //case WeaponType::Thunderbolt: TODO
+ default: PreloadMetadataAsync("Object/Crate/Generic"_s); break;
+ }
}
Task AmmoCrate::OnActivatedAsync(const ActorActivationDetails& details)
@@ -27,21 +39,21 @@ namespace Jazz2::Actors::Solid
AddContent(EventType::Ammo, 5, &details.Params[0], 1);
}
- async_await RequestMetadataAsync("Object/CrateContainer"_s);
-
switch (weaponType) {
- case WeaponType::Bouncer: SetAnimation("CrateAmmoBouncer"_s); break;
- case WeaponType::Freezer: SetAnimation("CrateAmmoFreezer"_s); break;
- case WeaponType::Seeker:SetAnimation("CrateAmmoSeeker"_s); break;
- case WeaponType::RF: SetAnimation("CrateAmmoRF"_s); break;
- case WeaponType::Toaster: SetAnimation("CrateAmmoToaster"_s); break;
- case WeaponType::TNT:SetAnimation("CrateAmmoTNT"_s); break;
- case WeaponType::Pepper: SetAnimation("CrateAmmoPepper"_s); break;
- case WeaponType::Electro: SetAnimation("CrateAmmoElectro"_s); break;
- case WeaponType::Thunderbolt: SetAnimation("CrateAmmoThunderbolt"_s); break;
- default: SetAnimation(AnimState::Idle); break;
+ case WeaponType::Bouncer: async_await RequestMetadataAsync("Object/Crate/AmmoBouncer"_s); break;
+ case WeaponType::Freezer: async_await RequestMetadataAsync("Object/Crate/AmmoFreezer"_s); break;
+ case WeaponType::Seeker: async_await RequestMetadataAsync("Object/Crate/AmmoSeeker"_s); break;
+ case WeaponType::RF: async_await RequestMetadataAsync("Object/Crate/AmmoRF"_s); break;
+ case WeaponType::Toaster: async_await RequestMetadataAsync("Object/Crate/AmmoToaster"_s); break;
+ case WeaponType::TNT: async_await RequestMetadataAsync("Object/Crate/AmmoTNT"_s); break;
+ case WeaponType::Pepper: async_await RequestMetadataAsync("Object/Crate/AmmoPepper"_s); break;
+ case WeaponType::Electro: async_await RequestMetadataAsync("Object/Crate/AmmoElectro"_s); break;
+ //case WeaponType::Thunderbolt: TODO
+ default: async_await RequestMetadataAsync("Object/Crate/Generic"_s); break;
}
+ SetAnimation(AnimState::Idle);
+
async_return true;
}
@@ -101,8 +113,8 @@ namespace Jazz2::Actors::Solid
AddContent(EventType::Ammo, 1, &weaponType, sizeof(weaponType));
}
- CreateSpriteDebris("CrateShrapnel1"_s, 3);
- CreateSpriteDebris("CrateShrapnel2"_s, 2);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 2);
_frozenTimeLeft = std::min(1.0f, _frozenTimeLeft);
SetTransition(AnimState::TransitionDeath, false, [this, collider]() {
@@ -111,8 +123,8 @@ namespace Jazz2::Actors::Solid
SpawnContent();
return true;
} else {
- CreateSpriteDebris("CrateAmmoShrapnel1"_s, 3);
- CreateSpriteDebris("CrateAmmoShrapnel2"_s, 2);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 2);
return GenericContainer::OnPerish(collider);
}
diff --git a/Sources/Jazz2/Actors/Solid/BarrelContainer.cpp b/Sources/Jazz2/Actors/Solid/BarrelContainer.cpp
index 6edd0075..cdd647fd 100644
--- a/Sources/Jazz2/Actors/Solid/BarrelContainer.cpp
+++ b/Sources/Jazz2/Actors/Solid/BarrelContainer.cpp
@@ -68,10 +68,10 @@ namespace Jazz2::Actors::Solid
CreateParticleDebris();
- CreateSpriteDebris("BarrelShrapnel1"_s, 3);
- CreateSpriteDebris("BarrelShrapnel2"_s, 3);
- CreateSpriteDebris("BarrelShrapnel3"_s, 2);
- CreateSpriteDebris("BarrelShrapnel4"_s, 1);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 3);
+ CreateSpriteDebris((AnimState)3, 2);
+ CreateSpriteDebris((AnimState)4, 1);
return GenericContainer::OnPerish(collider);
}
diff --git a/Sources/Jazz2/Actors/Solid/Bridge.cpp b/Sources/Jazz2/Actors/Solid/Bridge.cpp
index 0c0b2611..91a11b2a 100644
--- a/Sources/Jazz2/Actors/Solid/Bridge.cpp
+++ b/Sources/Jazz2/Actors/Solid/Bridge.cpp
@@ -65,7 +65,7 @@ namespace Jazz2::Actors::Solid
case BridgeType::Lab: async_await RequestMetadataAsync("Bridge/Lab"_s); _widths = PieceWidthsLab; _widthsCount = countof(PieceWidthsLab); _widthOffset = 12; break;
}
- SetAnimation("Piece"_s);
+ SetAnimation(AnimState::Default);
int widthCovered = _widths[0] / 2 - _widthOffset;
for (int i = 0; widthCovered <= _bridgeWidth + 4; i++) {
diff --git a/Sources/Jazz2/Actors/Solid/CrateContainer.cpp b/Sources/Jazz2/Actors/Solid/CrateContainer.cpp
index aefd4c27..5c841c54 100644
--- a/Sources/Jazz2/Actors/Solid/CrateContainer.cpp
+++ b/Sources/Jazz2/Actors/Solid/CrateContainer.cpp
@@ -13,7 +13,7 @@ namespace Jazz2::Actors::Solid
void CrateContainer::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/CrateContainer"_s);
+ PreloadMetadataAsync("Object/Crate/Generic"_s);
}
Task CrateContainer::OnActivatedAsync(const ActorActivationDetails& details)
@@ -26,7 +26,7 @@ namespace Jazz2::Actors::Solid
AddContent(eventType, count, &details.Params[3], 16 - 4);
}
- async_await RequestMetadataAsync("Object/CrateContainer"_s);
+ async_await RequestMetadataAsync("Object/Crate/Generic"_s);
SetAnimation(AnimState::Idle);
@@ -66,8 +66,8 @@ namespace Jazz2::Actors::Solid
PlaySfx("Break"_s);
- CreateSpriteDebris("CrateShrapnel1"_s, 3);
- CreateSpriteDebris("CrateShrapnel2"_s, 2);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 2);
_frozenTimeLeft = std::min(1.0f, _frozenTimeLeft);
SetTransition(AnimState::TransitionDeath, false, [this, collider]() {
diff --git a/Sources/Jazz2/Actors/Solid/GemBarrel.cpp b/Sources/Jazz2/Actors/Solid/GemBarrel.cpp
index cc55fac2..f533ade6 100644
--- a/Sources/Jazz2/Actors/Solid/GemBarrel.cpp
+++ b/Sources/Jazz2/Actors/Solid/GemBarrel.cpp
@@ -72,10 +72,10 @@ namespace Jazz2::Actors::Solid
CreateParticleDebris();
- CreateSpriteDebris("BarrelShrapnel1"_s, 3);
- CreateSpriteDebris("BarrelShrapnel2"_s, 3);
- CreateSpriteDebris("BarrelShrapnel3"_s, 2);
- CreateSpriteDebris("BarrelShrapnel4"_s, 1);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 3);
+ CreateSpriteDebris((AnimState)3, 2);
+ CreateSpriteDebris((AnimState)4, 1);
return GenericContainer::OnPerish(collider);
}
diff --git a/Sources/Jazz2/Actors/Solid/GemCrate.cpp b/Sources/Jazz2/Actors/Solid/GemCrate.cpp
index a90a20eb..09e146e1 100644
--- a/Sources/Jazz2/Actors/Solid/GemCrate.cpp
+++ b/Sources/Jazz2/Actors/Solid/GemCrate.cpp
@@ -13,7 +13,7 @@ namespace Jazz2::Actors::Solid
void GemCrate::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/CrateContainer"_s);
+ PreloadMetadataAsync("Object/Crate/Generic"_s);
PreloadMetadataAsync("Collectible/Gems"_s);
}
@@ -30,7 +30,7 @@ namespace Jazz2::Actors::Solid
eventParam = 3;
AddContent(EventType::Gem, details.Params[3], &eventParam, sizeof(eventParam));
- async_await RequestMetadataAsync("Object/CrateContainer"_s);
+ async_await RequestMetadataAsync("Object/Crate/Generic"_s);
SetAnimation(AnimState::Idle);
@@ -70,8 +70,8 @@ namespace Jazz2::Actors::Solid
PlaySfx("Break"_s);
- CreateSpriteDebris("CrateShrapnel1"_s, 3);
- CreateSpriteDebris("CrateShrapnel2"_s, 2);
+ CreateSpriteDebris((AnimState)1, 3);
+ CreateSpriteDebris((AnimState)2, 2);
_frozenTimeLeft = std::min(1.0f, _frozenTimeLeft);
SetTransition(AnimState::TransitionDeath, false, [this, collider]() {
diff --git a/Sources/Jazz2/Actors/Solid/MovingPlatform.cpp b/Sources/Jazz2/Actors/Solid/MovingPlatform.cpp
index 32563a8d..b3649b8c 100644
--- a/Sources/Jazz2/Actors/Solid/MovingPlatform.cpp
+++ b/Sources/Jazz2/Actors/Solid/MovingPlatform.cpp
@@ -63,7 +63,7 @@ namespace Jazz2::Actors::Solid
case PlatformType::SpikeBall: async_await RequestMetadataAsync("MovingPlatform/SpikeBall"_s); break;
}
- SetAnimation("Platform"_s);
+ SetAnimation((AnimState)0);
for (int i = 0; i < length; i++) {
ChainPiece& piece = _pieces.emplace_back();
@@ -209,9 +209,9 @@ namespace Jazz2::Actors::Solid
bool MovingPlatform::OnDraw(RenderQueue& renderQueue)
{
if (!_pieces.empty()) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("Chain"_s));
- if (it != _metadata->Graphics.end()) {
- auto& chainAnim = it->second;
+ AnimationCandidate candidates[5];
+ if (FindAnimationCandidates((AnimState)1, candidates) > 0) {
+ auto& chainAnim = *candidates[0].Resource;
Vector2i texSize = chainAnim.Base->TextureDiffuse->size();
for (int i = 0; i < _pieces.size(); i++) {
diff --git a/Sources/Jazz2/Actors/Solid/PinballBumper.cpp b/Sources/Jazz2/Actors/Solid/PinballBumper.cpp
index ca3352f9..6941e5b5 100644
--- a/Sources/Jazz2/Actors/Solid/PinballBumper.cpp
+++ b/Sources/Jazz2/Actors/Solid/PinballBumper.cpp
@@ -25,10 +25,7 @@ namespace Jazz2::Actors::Solid
async_await RequestMetadataAsync("Object/PinballBumper"_s);
- switch (theme) {
- case 0: SetAnimation((AnimState)0); break;
- case 1: SetAnimation((AnimState)1); break;
- }
+ SetAnimation((AnimState)theme);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Solid/Pole.cpp b/Sources/Jazz2/Actors/Solid/Pole.cpp
index 62fe2671..3f880143 100644
--- a/Sources/Jazz2/Actors/Solid/Pole.cpp
+++ b/Sources/Jazz2/Actors/Solid/Pole.cpp
@@ -57,7 +57,7 @@ namespace Jazz2::Actors::Solid
SetState(ActorState::IsSolidObject, true);
}
- SetAnimation("Pole"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp b/Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp
index 9424933d..4cf1086e 100644
--- a/Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp
+++ b/Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp
@@ -15,7 +15,13 @@ namespace Jazz2::Actors::Solid
void PowerUpMorphMonitor::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/PowerUpMonitor"_s);
+ MorphType morphType = (MorphType)details.Params[0];
+ switch (morphType) {
+ case MorphType::Swap2: PreloadMetadataAsync("Object/PowerUp/Swap2"_s); break;
+ case MorphType::Swap3: PreloadMetadataAsync("Object/PowerUp/Swap3"_s); break;
+ case MorphType::ToBird: PreloadMetadataAsync("Object/PowerUp/Bird"_s); break;
+ default: PreloadMetadataAsync("Object/PowerUp/Empty"_s); break;
+ }
}
Task PowerUpMorphMonitor::OnActivatedAsync(const ActorActivationDetails& details)
@@ -25,14 +31,15 @@ namespace Jazz2::Actors::Solid
SetState(ActorState::TriggersTNT, true);
Movable = true;
- async_await RequestMetadataAsync("Object/PowerUpMonitor"_s);
-
switch (_morphType) {
- case MorphType::Swap2: SetAnimation("Swap2"_s); break;
- case MorphType::Swap3: SetAnimation("Swap3"_s); break;
- case MorphType::ToBird: SetAnimation("Bird"_s); break;
+ case MorphType::Swap2: async_await RequestMetadataAsync("Object/PowerUp/Swap2"_s); break;
+ case MorphType::Swap3: async_await RequestMetadataAsync("Object/PowerUp/Swap3"_s); break;
+ case MorphType::ToBird: async_await RequestMetadataAsync("Object/PowerUp/Bird"_s); break;
+ default: async_await RequestMetadataAsync("Object/PowerUp/Empty"_s); break;
}
+ SetAnimation(AnimState::Default);
+
auto& players = _levelHandler->GetPlayers();
for (auto& player : players) {
std::optional playerType = GetTargetType(player->GetPlayerType());
diff --git a/Sources/Jazz2/Actors/Solid/PowerUpShieldMonitor.cpp b/Sources/Jazz2/Actors/Solid/PowerUpShieldMonitor.cpp
index 87d63fdf..3b0312fa 100644
--- a/Sources/Jazz2/Actors/Solid/PowerUpShieldMonitor.cpp
+++ b/Sources/Jazz2/Actors/Solid/PowerUpShieldMonitor.cpp
@@ -15,7 +15,14 @@ namespace Jazz2::Actors::Solid
void PowerUpShieldMonitor::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/PowerUpMonitorShield"_s);
+ ShieldType shieldType = (ShieldType)details.Params[0];
+ switch (shieldType) {
+ case ShieldType::Fire: PreloadMetadataAsync("Object/PowerUp/ShieldFire"_s); break;
+ case ShieldType::Water: PreloadMetadataAsync("Object/PowerUp/ShieldWater"_s); break;
+ case ShieldType::Laser: PreloadMetadataAsync("Object/PowerUp/ShieldLaser"_s); break;
+ case ShieldType::Lightning: PreloadMetadataAsync("Object/PowerUp/ShieldLightning"_s); break;
+ default: PreloadMetadataAsync("Object/PowerUp/Empty"_s); break;
+ }
}
Task PowerUpShieldMonitor::OnActivatedAsync(const ActorActivationDetails& details)
@@ -25,17 +32,16 @@ namespace Jazz2::Actors::Solid
SetState(ActorState::TriggersTNT, true);
Movable = true;
- async_await RequestMetadataAsync("Object/PowerUpMonitorShield"_s);
-
switch (_shieldType) {
- case ShieldType::Fire: SetAnimation("ShieldFire"_s); break;
- case ShieldType::Water: SetAnimation("ShieldWater"_s); break;
- case ShieldType::Laser: SetAnimation("ShieldLaser"_s); break;
- case ShieldType::Lightning: SetAnimation("ShieldLightning"_s); break;
-
- default: SetAnimation("Empty"_s); break;
+ case ShieldType::Fire: async_await RequestMetadataAsync("Object/PowerUp/ShieldFire"_s); break;
+ case ShieldType::Water: async_await RequestMetadataAsync("Object/PowerUp/ShieldWater"_s); break;
+ case ShieldType::Laser: async_await RequestMetadataAsync("Object/PowerUp/ShieldLaser"_s); break;
+ case ShieldType::Lightning: async_await RequestMetadataAsync("Object/PowerUp/ShieldLightning"_s); break;
+ default: async_await RequestMetadataAsync("Object/PowerUp/Empty"_s); break;
}
+ SetAnimation(AnimState::Default);
+
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Solid/PowerUpWeaponMonitor.cpp b/Sources/Jazz2/Actors/Solid/PowerUpWeaponMonitor.cpp
index 2e9a268b..e6f892e7 100644
--- a/Sources/Jazz2/Actors/Solid/PowerUpWeaponMonitor.cpp
+++ b/Sources/Jazz2/Actors/Solid/PowerUpWeaponMonitor.cpp
@@ -15,7 +15,20 @@ namespace Jazz2::Actors::Solid
void PowerUpWeaponMonitor::Preload(const ActorActivationDetails& details)
{
- PreloadMetadataAsync("Object/PowerUpMonitor"_s);
+ WeaponType weaponType = (WeaponType)details.Params[0];
+ switch (weaponType) {
+ case WeaponType::Blaster: PreloadMetadataAsync("Object/PowerUp/Blaster"_s); break;
+ case WeaponType::Bouncer: PreloadMetadataAsync("Object/PowerUp/Bouncer"_s); break;
+ case WeaponType::Freezer: PreloadMetadataAsync("Object/PowerUp/Freezer"_s); break;
+ case WeaponType::Seeker: PreloadMetadataAsync("Object/PowerUp/Seeker"_s); break;
+ case WeaponType::RF: PreloadMetadataAsync("Object/PowerUp/RF"_s); break;
+ case WeaponType::Toaster: PreloadMetadataAsync("Object/PowerUp/Toaster"_s); break;
+ //case WeaponType::TNT: TODO
+ case WeaponType::Pepper: PreloadMetadataAsync("Object/PowerUp/Pepper"_s); break;
+ case WeaponType::Electro: PreloadMetadataAsync("Object/PowerUp/Electro"_s); break;
+ //case WeaponType::Thunderbolt: TODO
+ default: PreloadMetadataAsync("Object/PowerUp/Empty"_s); break;
+ }
}
Task PowerUpWeaponMonitor::OnActivatedAsync(const ActorActivationDetails& details)
@@ -25,30 +38,31 @@ namespace Jazz2::Actors::Solid
SetState(ActorState::TriggersTNT, true);
Movable = true;
- async_await RequestMetadataAsync("Object/PowerUpMonitor"_s);
-
switch (_weaponType) {
- default:
- case WeaponType::Blaster: {
- auto& players = _levelHandler->GetPlayers();
- PlayerType playerType = (!players.empty() ? players[0]->GetPlayerType() : PlayerType::Jazz);
- switch (playerType) {
- default:
- case PlayerType::Jazz: SetAnimation("BlasterJazz"_s); break;
- case PlayerType::Spaz: SetAnimation("BlasterSpaz"_s); break;
- case PlayerType::Lori: SetAnimation("BlasterLori"_s); break;
- }
- break;
+ case WeaponType::Blaster: async_await RequestMetadataAsync("Object/PowerUp/Blaster"_s); break;
+ case WeaponType::Bouncer: async_await RequestMetadataAsync("Object/PowerUp/Bouncer"_s); break;
+ case WeaponType::Freezer: async_await RequestMetadataAsync("Object/PowerUp/Freezer"_s); break;
+ case WeaponType::Seeker: async_await RequestMetadataAsync("Object/PowerUp/Seeker"_s); break;
+ case WeaponType::RF: async_await RequestMetadataAsync("Object/PowerUp/RF"_s); break;
+ case WeaponType::Toaster: async_await RequestMetadataAsync("Object/PowerUp/Toaster"_s); break;
+ //case WeaponType::TNT: TODO
+ case WeaponType::Pepper: async_await RequestMetadataAsync("Object/PowerUp/Pepper"_s); break;
+ case WeaponType::Electro: async_await RequestMetadataAsync("Object/PowerUp/Electro"_s); break;
+ //case WeaponType::Thunderbolt: TODO
+ default: async_await RequestMetadataAsync("Object/PowerUp/Empty"_s); break;
+ }
+
+ if (_weaponType == WeaponType::Blaster) {
+ auto& players = _levelHandler->GetPlayers();
+ PlayerType playerType = (!players.empty() ? players[0]->GetPlayerType() : PlayerType::Jazz);
+ switch (playerType) {
+ case PlayerType::Jazz:
+ case PlayerType::Spaz:
+ case PlayerType::Lori: SetAnimation((AnimState)playerType); break;
+ default: SetAnimation((AnimState)PlayerType::Jazz); break;
}
- case WeaponType::Bouncer: SetAnimation("Bouncer"_s); break;
- case WeaponType::Freezer: SetAnimation("Freezer"_s); break;
- case WeaponType::Seeker:SetAnimation("Seeker"_s); break;
- case WeaponType::RF: SetAnimation("RF"_s); break;
- case WeaponType::Toaster: SetAnimation("Toaster"_s); break;
- case WeaponType::TNT:SetAnimation("TNT"_s); break;
- case WeaponType::Pepper: SetAnimation("Pepper"_s); break;
- case WeaponType::Electro: SetAnimation("Electro"_s); break;
- case WeaponType::Thunderbolt: SetAnimation("Thunderbolt"_s); break;
+ } else {
+ SetAnimation(AnimState::Default);
}
async_return true;
diff --git a/Sources/Jazz2/Actors/Solid/PushableBox.cpp b/Sources/Jazz2/Actors/Solid/PushableBox.cpp
index 00d0f373..3c79abfc 100644
--- a/Sources/Jazz2/Actors/Solid/PushableBox.cpp
+++ b/Sources/Jazz2/Actors/Solid/PushableBox.cpp
@@ -34,7 +34,7 @@ namespace Jazz2::Actors::Solid
case 1: async_await RequestMetadataAsync("Object/PushBoxCrate"); break;
}
- SetAnimation("PushBox"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Solid/SpikeBall.cpp b/Sources/Jazz2/Actors/Solid/SpikeBall.cpp
index 5ec12f4b..c83aec14 100644
--- a/Sources/Jazz2/Actors/Solid/SpikeBall.cpp
+++ b/Sources/Jazz2/Actors/Solid/SpikeBall.cpp
@@ -31,7 +31,7 @@ namespace Jazz2::Actors::Solid
SetState(ActorState::CanBeFrozen | ActorState::CollideWithTileset | ActorState::ApplyGravitation, false);
async_await RequestMetadataAsync("MovingPlatform/SpikeBall"_s);
- SetAnimation("Platform"_s);
+ SetAnimation((AnimState)0);
for (int i = 0; i < length; i++) {
ChainPiece& piece = _pieces.emplace_back();
@@ -92,9 +92,9 @@ namespace Jazz2::Actors::Solid
bool SpikeBall::OnDraw(RenderQueue& renderQueue)
{
if (!_pieces.empty()) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("Chain"_s));
- if (it != _metadata->Graphics.end()) {
- auto& chainAnim = it->second;
+ AnimationCandidate candidates[5];
+ if (FindAnimationCandidates((AnimState)1, candidates) > 0) {
+ auto& chainAnim = *candidates[0].Resource;
Vector2i texSize = chainAnim.Base->TextureDiffuse->size();
for (int i = 0; i < _pieces.size(); i++) {
diff --git a/Sources/Jazz2/Actors/Solid/TriggerCrate.cpp b/Sources/Jazz2/Actors/Solid/TriggerCrate.cpp
index 246586c9..27e0e4d1 100644
--- a/Sources/Jazz2/Actors/Solid/TriggerCrate.cpp
+++ b/Sources/Jazz2/Actors/Solid/TriggerCrate.cpp
@@ -31,7 +31,7 @@ namespace Jazz2::Actors::Solid
async_await RequestMetadataAsync("Object/TriggerCrate"_s);
- SetAnimation("Crate"_s);
+ SetAnimation(AnimState::Default);
async_return true;
}
diff --git a/Sources/Jazz2/Actors/Weapons/ElectroShot.cpp b/Sources/Jazz2/Actors/Weapons/ElectroShot.cpp
index d8578777..ea849645 100644
--- a/Sources/Jazz2/Actors/Weapons/ElectroShot.cpp
+++ b/Sources/Jazz2/Actors/Weapons/ElectroShot.cpp
@@ -79,8 +79,8 @@ namespace Jazz2::Actors::Weapons
auto tilemap = _levelHandler->TileMap();
if (tilemap != nullptr) {
- auto it = _metadata->Graphics.find(String::nullTerminatedView("Particle"_s));
- if (it != _metadata->Graphics.end()) {
+ auto it = _metadata->Animations.find(String::nullTerminatedView("Particle"_s));
+ if (it != _metadata->Animations.end()) {
auto& resBase = it->second.Base;
Vector2i texSize = resBase->TextureDiffuse->size();
diff --git a/Sources/Jazz2/AnimState.h b/Sources/Jazz2/AnimState.h
index 1442c756..38d0cfd3 100644
--- a/Sources/Jazz2/AnimState.h
+++ b/Sources/Jazz2/AnimState.h
@@ -90,10 +90,8 @@ namespace Jazz2
TransitionAttack = 0x4F000001,
TransitionAttackEnd = 0x4F000002,
- // Alias for setting transition by name instead by AnimState
- TransitionByName = -2,
-
Uninitialized = -1,
+ Default = 0
};
DEFINE_ENUM_OPERATORS(AnimState);
diff --git a/Sources/Jazz2/Compatibility/JJ2Anims.cpp b/Sources/Jazz2/Compatibility/JJ2Anims.cpp
index 995e99d1..4a1e3269 100644
--- a/Sources/Jazz2/Compatibility/JJ2Anims.cpp
+++ b/Sources/Jazz2/Compatibility/JJ2Anims.cpp
@@ -332,12 +332,12 @@ namespace Jazz2::Compatibility
// TODO: Hardcoded name
bool applyToasterPowerUpFix = (entry->Category == "Object"_s && entry->Name == "powerup_upgrade_toaster"_s);
if (applyToasterPowerUpFix) {
- LOGI("Applying \"Toaster PowerUp\" palette fix.");
+ LOGI("Applying \"Toaster PowerUp\" palette fix");
}
bool applyVineFix = (entry->Category == "Object" && entry->Name == "vine");
if (applyVineFix) {
- LOGI("Applying \"Vine\" palette fix.");
+ LOGI("Applying \"Vine\" palette fix");
}
String filename;
diff --git a/Sources/Jazz2/ContentResolver.cpp b/Sources/Jazz2/ContentResolver.cpp
index 6f5365f2..a25a8ec4 100644
--- a/Sources/Jazz2/ContentResolver.cpp
+++ b/Sources/Jazz2/ContentResolver.cpp
@@ -49,6 +49,28 @@ static Vector2i GetVector2iFromJson(simdjson_result value, Vector2i defaultVa
namespace Jazz2
{
+ GenericGraphicResource::GenericGraphicResource()
+ {
+ }
+
+ GraphicResource::GraphicResource()
+ {
+ }
+
+ GenericSoundResource::GenericSoundResource(const StringView& path)
+ : Buffer(path)
+ {
+ }
+
+ SoundResource::SoundResource()
+ {
+ }
+
+ Metadata::Metadata()
+ : Flags(MetadataFlags::None)
+ {
+ }
+
ContentResolver& ContentResolver::Get()
{
static ContentResolver current;
@@ -69,6 +91,7 @@ namespace Jazz2
{
_cachedMetadata.clear();
_cachedGraphics.clear();
+ _cachedSounds.clear();
for (int32_t i = 0; i < (int32_t)FontType::Count; i++) {
_fonts[i] = nullptr;
@@ -79,6 +102,49 @@ namespace Jazz2
}
}
+ StringView ContentResolver::GetContentPath() const
+ {
+#if defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
+ return _contentPath;
+#elif defined(DEATH_TARGET_ANDROID)
+ return "asset::"_s;
+#elif defined(DEATH_TARGET_SWITCH)
+ return "romfs:/"_s;
+#elif defined(DEATH_TARGET_WINDOWS)
+ return "Content\\"_s;
+#else
+ return "Content/"_s;
+#endif
+ }
+
+ StringView ContentResolver::GetCachePath() const
+ {
+#if defined(DEATH_TARGET_ANDROID) || defined(DEATH_TARGET_APPLE) || defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
+ return _cachePath;
+#elif defined(DEATH_TARGET_SWITCH)
+ // Switch has some issues with UTF-8 characters, so use "Jazz2" instead
+ return "sdmc:/Games/Jazz2/Cache/"_s;
+#elif defined(DEATH_TARGET_WINDOWS)
+ return "Cache\\"_s;
+#else
+ return "Cache/"_s;
+#endif
+ }
+
+ StringView ContentResolver::GetSourcePath() const
+ {
+#if defined(DEATH_TARGET_ANDROID) || defined(DEATH_TARGET_APPLE) || defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
+ return _sourcePath;
+#elif defined(DEATH_TARGET_SWITCH)
+ // Switch has some issues with UTF-8 characters, so use "Jazz2" instead
+ return "sdmc:/Games/Jazz2/Source/"_s;
+#elif defined(DEATH_TARGET_WINDOWS)
+ return "Source\\"_s;
+#else
+ return "Source/"_s;
+#endif
+ }
+
bool ContentResolver::IsHeadless() const
{
return _isHeadless;
@@ -234,18 +300,33 @@ namespace Jazz2
for (auto& resource : _cachedGraphics) {
resource.second->Flags &= ~GenericGraphicResourceFlags::Referenced;
}
+ for (auto& resource : _cachedSounds) {
+ resource.second->Flags &= ~GenericSoundResourceFlags::Referenced;
+ }
}
void ContentResolver::EndLoading()
{
+#if defined(DEATH_DEBUG)
+ std::int32_t metadataKept = 0, metadataReleased = 0;
+ std::int32_t animationsKept = 0, animationsReleased = 0;
+ std::int32_t soundsKept = 0, soundsReleased = 0;
+#endif
+
// Release unreferenced metadata
{
auto it = _cachedMetadata.begin();
while (it != _cachedMetadata.end()) {
if ((it->second->Flags & MetadataFlags::Referenced) != MetadataFlags::Referenced) {
it = _cachedMetadata.erase(it);
+#if defined(DEATH_DEBUG)
+ metadataReleased++;
+#endif
} else {
++it;
+#if defined(DEATH_DEBUG)
+ metadataKept++;
+#endif
}
}
}
@@ -256,12 +337,41 @@ namespace Jazz2
while (it != _cachedGraphics.end()) {
if ((it->second->Flags & GenericGraphicResourceFlags::Referenced) != GenericGraphicResourceFlags::Referenced) {
it = _cachedGraphics.erase(it);
+#if defined(DEATH_DEBUG)
+ animationsReleased++;
+#endif
+ } else {
+ ++it;
+#if defined(DEATH_DEBUG)
+ animationsKept++;
+#endif
+ }
+ }
+ }
+
+ // Released unreferenced sounds
+ {
+ auto it = _cachedSounds.begin();
+ while (it != _cachedSounds.end()) {
+ if ((it->second->Flags & GenericSoundResourceFlags::Referenced) != GenericSoundResourceFlags::Referenced) {
+ it = _cachedSounds.erase(it);
+#if defined(DEATH_DEBUG)
+ soundsReleased++;
+#endif
} else {
++it;
+#if defined(DEATH_DEBUG)
+ soundsKept++;
+#endif
}
}
}
+#if defined(DEATH_DEBUG)
+ LOGW("Metadata: %i|%i, Animations: %i|%i, Sounds: %i|%i", metadataKept, metadataReleased,
+ animationsKept, animationsReleased, soundsKept, soundsReleased);
+#endif
+
_isLoading = false;
}
@@ -279,10 +389,16 @@ namespace Jazz2
// Already loaded - Mark as referenced
it->second->Flags |= MetadataFlags::Referenced;
- for (auto& resource : it->second->Graphics) {
+ for (auto& resource : it->second->Animations) {
resource.second.Base->Flags |= GenericGraphicResourceFlags::Referenced;
}
+ for (auto& resource : it->second->Sounds) {
+ for (auto& base : resource.second.Buffers) {
+ base->Flags |= GenericSoundResourceFlags::Referenced;
+ }
+ }
+
return it->second.get();
}
@@ -298,6 +414,8 @@ namespace Jazz2
s->Read(buffer.get(), fileSize);
buffer[fileSize] = '\0';
+ bool multipleAnimsNoStatesWarning = false;
+
std::unique_ptr metadata = std::make_unique();
metadata->Flags |= MetadataFlags::Referenced;
@@ -310,7 +428,7 @@ namespace Jazz2
if (doc["Animations"].get(animations) == SUCCESS) {
size_t count;
if (animations.count_fields().get(count) == SUCCESS) {
- metadata->Graphics.reserve(count);
+ metadata->Animations.reserve(count);
}
for (auto it : animations) {
@@ -326,7 +444,7 @@ namespace Jazz2
//bool keepIndexed = false;
- uint64_t flags;
+ std::uint64_t flags;
if (value["Flags"].get(flags) == SUCCESS) {
if ((flags & 0x01) == 0x01) {
graphics.LoopMode = AnimationLoopMode::Once;
@@ -337,7 +455,7 @@ namespace Jazz2
}
// TODO: Implement true indexed sprites
- uint64_t paletteOffset;
+ std::uint64_t paletteOffset;
if (value["PaletteOffset"].get(paletteOffset) != SUCCESS) {
paletteOffset = 0;
}
@@ -347,7 +465,7 @@ namespace Jazz2
continue;
}
- int64_t frameOffset;
+ std::int64_t frameOffset;
if (value["FrameOffset"].get(frameOffset) != SUCCESS) {
frameOffset = 0;
}
@@ -356,7 +474,7 @@ namespace Jazz2
graphics.AnimDuration = graphics.Base->AnimDuration;
graphics.FrameCount = graphics.Base->FrameCount;
- int64_t frameCount;
+ std::int64_t frameCount;
if (value["FrameCount"].get(frameCount) == SUCCESS) {
graphics.FrameCount = (int32_t)frameCount;
} else {
@@ -372,11 +490,18 @@ namespace Jazz2
ondemand::array states;
if (value["States"].get(states) == SUCCESS) {
for (auto stateItem : states) {
- int64_t state;
+ std::int64_t state;
if (stateItem.get(state) == SUCCESS) {
graphics.State.push_back((AnimState)state);
}
}
+ } else if (count > 1) {
+ if (!multipleAnimsNoStatesWarning) {
+ multipleAnimsNoStatesWarning = true;
+ LOGW("Multiple animations defined but no states specified in file \"%s\"", path.data());
+ }
+ } else {
+ graphics.State.push_back(AnimState::Default);
}
// If no bounding box is provided, use the first sprite
@@ -385,7 +510,7 @@ namespace Jazz2
metadata->BoundingBox = graphics.Base->FrameDimensions - Vector2i(2, 2);
}
- metadata->Graphics.emplace(key, std::move(graphics));
+ metadata->Animations.emplace(key, std::move(graphics));
}
}
@@ -414,14 +539,22 @@ namespace Jazz2
std::string_view assetPath;
if (assetPathItem.get(assetPath) == SUCCESS && !assetPath.empty()) {
auto assetPathNormalized = fs::ToNativeSeparators(assetPath);
- String fullPath = fs::CombinePath({ GetContentPath(), "Animations"_s, assetPathNormalized });
- if (!fs::IsReadableFile(fullPath)) {
- fullPath = fs::CombinePath({ GetCachePath(), "Animations"_s, assetPathNormalized });
+ auto it = _cachedSounds.find(assetPathNormalized);
+ if (it != _cachedSounds.end()) {
+ it->second->Flags |= GenericSoundResourceFlags::Referenced;
+ sound.Buffers.emplace_back(it->second.get());
+ } else {
+ String fullPath = fs::CombinePath({ GetContentPath(), "Animations"_s, assetPathNormalized });
if (!fs::IsReadableFile(fullPath)) {
- continue;
+ fullPath = fs::CombinePath({ GetCachePath(), "Animations"_s, assetPathNormalized });
+ if (!fs::IsReadableFile(fullPath)) {
+ continue;
+ }
}
+ auto res = _cachedSounds.emplace(assetPathNormalized, std::make_unique(fullPath));
+ res.first->second->Flags |= GenericSoundResourceFlags::Referenced;
+ sound.Buffers.emplace_back(res.first->second.get());
}
- sound.Buffers.emplace_back(std::make_unique(fullPath));
}
}
@@ -788,6 +921,9 @@ namespace Jazz2
if (std::memcmp(_palettes, newPalette, ColorsPerPalette * sizeof(uint32_t)) != 0) {
// Palettes differs, drop all cached resources, so it will be reloaded with new palette
if (_isLoading) {
+#if defined(DEATH_DEBUG)
+ LOGW("Releasing all animations because of different palette - Metadata: 0|%i, Animations: 0|%i", (std::int32_t)_cachedMetadata.size(), (std::int32_t)_cachedGraphics.size());
+#endif
_cachedMetadata.clear();
_cachedGraphics.clear();
diff --git a/Sources/Jazz2/ContentResolver.h b/Sources/Jazz2/ContentResolver.h
index 52f36f27..8dbccac6 100644
--- a/Sources/Jazz2/ContentResolver.h
+++ b/Sources/Jazz2/ContentResolver.h
@@ -35,7 +35,8 @@ namespace Jazz2
class TileSet;
}
- enum class AnimationLoopMode {
+ enum class AnimationLoopMode
+ {
// The animation is played once an then remains in its last frame.
Once,
// The animation is looped: When reaching the last frame, it begins again at the first one.
@@ -44,7 +45,8 @@ namespace Jazz2
FixedSingle
};
- enum class GenericGraphicResourceFlags {
+ enum class GenericGraphicResourceFlags
+ {
None = 0x00,
Referenced = 0x01
@@ -52,9 +54,8 @@ namespace Jazz2
DEFINE_ENUM_OPERATORS(GenericGraphicResourceFlags);
- class GenericGraphicResource
+ struct GenericGraphicResource
{
- public:
GenericGraphicResourceFlags Flags;
//GenericGraphicResourceAsyncFinalize AsyncFinalize;
@@ -64,25 +65,28 @@ namespace Jazz2
Vector2i FrameDimensions;
Vector2i FrameConfiguration;
float AnimDuration;
- int32_t FrameCount;
+ std::int32_t FrameCount;
Vector2i Hotspot;
Vector2i Coldspot;
Vector2i Gunspot;
+
+ GenericGraphicResource();
};
- class GraphicResource
+ struct GraphicResource
{
- public:
GenericGraphicResource* Base;
//GraphicResourceAsyncFinalize AsyncFinalize;
SmallVector State;
//std::unique_ptr Material;
float AnimDuration;
- int32_t FrameCount;
- int32_t FrameOffset;
+ std::int32_t FrameCount;
+ std::int32_t FrameOffset;
AnimationLoopMode LoopMode;
+ GraphicResource();
+
bool HasState(AnimState state)
{
for (auto& current : State) {
@@ -94,10 +98,28 @@ namespace Jazz2
}
};
- class SoundResource
+ enum class GenericSoundResourceFlags
{
- public:
- SmallVector, 1> Buffers;
+ None = 0x00,
+
+ Referenced = 0x01
+ };
+
+ DEFINE_ENUM_OPERATORS(GenericSoundResourceFlags);
+
+ struct GenericSoundResource
+ {
+ AudioBuffer Buffer;
+ GenericSoundResourceFlags Flags;
+
+ GenericSoundResource(const StringView& path);
+ };
+
+ struct SoundResource
+ {
+ SmallVector Buffers;
+
+ SoundResource();
};
enum class MetadataFlags {
@@ -109,22 +131,18 @@ namespace Jazz2
DEFINE_ENUM_OPERATORS(MetadataFlags);
- class Metadata
+ struct Metadata
{
- public:
MetadataFlags Flags;
-
- HashMap Graphics;
+ HashMap Animations;
HashMap Sounds;
Vector2i BoundingBox;
- Metadata()
- : Flags(MetadataFlags::None)
- {
- }
+ Metadata();
};
- enum class TileDestructType {
+ enum class TileDestructType
+ {
None = 0x00,
Weapon = 0x01,
@@ -138,39 +156,44 @@ namespace Jazz2
DEFINE_ENUM_OPERATORS(TileDestructType);
- struct TileCollisionParams {
+ struct TileCollisionParams
+ {
TileDestructType DestructType;
bool Downwards;
WeaponType UsedWeaponType;
- int32_t WeaponStrength;
+ std::int32_t WeaponStrength;
float Speed;
- /*out*/ int32_t TilesDestroyed;
+ /*out*/ std::int32_t TilesDestroyed;
};
- enum class SuspendType {
+ enum class SuspendType
+ {
None,
Vine,
Hook,
SwingingVine
};
- struct Episode {
+ struct Episode
+ {
String Name;
String DisplayName;
String FirstLevel;
String PreviousEpisode;
String NextEpisode;
- uint16_t Position;
+ std::uint16_t Position;
};
- enum class FontType {
+ enum class FontType
+ {
Small,
Medium,
Count
};
- enum class PrecompiledShader {
+ enum class PrecompiledShader
+ {
Lighting,
BatchedLighting,
@@ -218,14 +241,14 @@ namespace Jazz2
class ContentResolver
{
public:
- static constexpr uint8_t LevelFile = 1;
- static constexpr uint8_t EpisodeFile = 2;
- static constexpr uint8_t CacheIndexFile = 3;
- static constexpr uint8_t ConfigFile = 4;
+ static constexpr std::uint8_t LevelFile = 1;
+ static constexpr std::uint8_t EpisodeFile = 2;
+ static constexpr std::uint8_t CacheIndexFile = 3;
+ static constexpr std::uint8_t ConfigFile = 4;
- static constexpr int32_t PaletteCount = 256;
- static constexpr int32_t ColorsPerPalette = 256;
- static constexpr int32_t InvalidValue = INT_MAX;
+ static constexpr std::int32_t PaletteCount = 256;
+ static constexpr std::int32_t ColorsPerPalette = 256;
+ static constexpr std::int32_t InvalidValue = INT_MAX;
static ContentResolver& Get();
@@ -233,6 +256,10 @@ namespace Jazz2
void Release();
+ StringView GetContentPath() const;
+ StringView GetCachePath() const;
+ StringView GetSourcePath() const;
+
bool IsHeadless() const;
void SetHeadless(bool value);
@@ -256,50 +283,10 @@ namespace Jazz2
void CompileShaders();
static std::unique_ptr GetNoiseTexture();
- const uint32_t* GetPalettes() const {
+ const std::uint32_t* GetPalettes() const {
return _palettes;
}
- StringView GetContentPath() const {
-#if defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
- return _contentPath;
-#elif defined(DEATH_TARGET_ANDROID)
- return "asset::"_s;
-#elif defined(DEATH_TARGET_SWITCH)
- return "romfs:/"_s;
-#elif defined(DEATH_TARGET_WINDOWS)
- return "Content\\"_s;
-#else
- return "Content/"_s;
-#endif
- }
-
- StringView GetCachePath() const {
-#if defined(DEATH_TARGET_ANDROID) || defined(DEATH_TARGET_APPLE) || defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
- return _cachePath;
-#elif defined(DEATH_TARGET_SWITCH)
- // Switch has some issues with UTF-8 characters, so use "Jazz2" instead
- return "sdmc:/Games/Jazz2/Cache/"_s;
-#elif defined(DEATH_TARGET_WINDOWS)
- return "Cache\\"_s;
-#else
- return "Cache/"_s;
-#endif
- }
-
- StringView GetSourcePath() const {
-#if defined(DEATH_TARGET_ANDROID) || defined(DEATH_TARGET_APPLE) || defined(DEATH_TARGET_UNIX) || defined(DEATH_TARGET_WINDOWS_RT)
- return _sourcePath;
-#elif defined(DEATH_TARGET_SWITCH)
- // Switch has some issues with UTF-8 characters, so use "Jazz2" instead
- return "sdmc:/Games/Jazz2/Source/"_s;
-#elif defined(DEATH_TARGET_WINDOWS)
- return "Source\\"_s;
-#else
- return "Source/"_s;
-#endif
- }
-
private:
ContentResolver();
@@ -324,6 +311,7 @@ namespace Jazz2
uint32_t _palettes[PaletteCount * ColorsPerPalette];
HashMap> _cachedMetadata;
HashMap, std::unique_ptr> _cachedGraphics;
+ HashMap> _cachedSounds;
std::unique_ptr _fonts[(int32_t)FontType::Count];
std::unique_ptr _precompiledShaders[(int32_t)PrecompiledShader::Count];
diff --git a/Sources/Jazz2/LevelHandler.cpp b/Sources/Jazz2/LevelHandler.cpp
index 00fe2d63..df0b9af1 100644
--- a/Sources/Jazz2/LevelHandler.cpp
+++ b/Sources/Jazz2/LevelHandler.cpp
@@ -369,8 +369,8 @@ namespace Jazz2
WeatherType realWeatherType = (_weatherType & ~WeatherType::OutdoorsOnly);
if (realWeatherType == WeatherType::Rain) {
- auto it = _commonResources->Graphics.find(String::nullTerminatedView("Rain"_s));
- if (it != _commonResources->Graphics.end()) {
+ auto it = _commonResources->Animations.find(String::nullTerminatedView("Rain"_s));
+ if (it != _commonResources->Animations.end()) {
auto& resBase = it->second.Base;
Vector2i texSize = resBase->TextureDiffuse->size();
float scale = Random().FastFloat(0.4f, 1.1f);
@@ -407,8 +407,8 @@ namespace Jazz2
_tileMap->CreateDebris(debris);
}
} else {
- auto it = _commonResources->Graphics.find(String::nullTerminatedView("Snow"_s));
- if (it != _commonResources->Graphics.end()) {
+ auto it = _commonResources->Animations.find(String::nullTerminatedView("Snow"_s));
+ if (it != _commonResources->Animations.end()) {
auto& resBase = it->second.Base;
Vector2i texSize = resBase->TextureDiffuse->size();
float scale = Random().FastFloat(0.4f, 1.1f);
@@ -720,7 +720,7 @@ namespace Jazz2
auto it = _commonResources->Sounds.find(String::nullTerminatedView(identifier));
if (it != _commonResources->Sounds.end()) {
int32_t idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int32_t)it->second.Buffers.size()) : 0);
- auto& player = _playingSounds.emplace_back(std::make_shared(it->second.Buffers[idx].get()));
+ auto& player = _playingSounds.emplace_back(std::make_shared(&it->second.Buffers[idx]->Buffer));
player->setPosition(Vector3f(pos.X, pos.Y, 100.0f));
player->setGain(gain * PreferencesCache::MasterVolume * PreferencesCache::SfxVolume);
@@ -1084,7 +1084,7 @@ namespace Jazz2
auto it = _commonResources->Sounds.find(String::nullTerminatedView("SugarRush"_s));
if (it != _commonResources->Sounds.end()) {
int32_t idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int32_t)it->second.Buffers.size()) : 0);
- _sugarRushMusic = _playingSounds.emplace_back(std::make_shared(it->second.Buffers[idx].get()));
+ _sugarRushMusic = _playingSounds.emplace_back(std::make_shared(&it->second.Buffers[idx]->Buffer));
_sugarRushMusic->setPosition(Vector3f(0.0f, 0.0f, 100.0f));
_sugarRushMusic->setGain(PreferencesCache::MasterVolume * PreferencesCache::MusicVolume);
_sugarRushMusic->setSourceRelative(true);
diff --git a/Sources/Jazz2/Scripting/ScriptActorWrapper.cpp b/Sources/Jazz2/Scripting/ScriptActorWrapper.cpp
index 8abc36ea..e1d9bbb5 100644
--- a/Sources/Jazz2/Scripting/ScriptActorWrapper.cpp
+++ b/Sources/Jazz2/Scripting/ScriptActorWrapper.cpp
@@ -170,7 +170,6 @@ shared abstract class CollectibleBase : )" AsClassName R"(
r = engine->RegisterObjectMethod(AsClassNameInternal, "void TryStandardMovement(float)", asMETHOD(ScriptActorWrapper, asTryStandardMovement), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassNameInternal, "void RequestMetadata(const string &in)", asMETHOD(ScriptActorWrapper, asRequestMetadata), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassNameInternal, "void PlaySfx(const string &in, float, float)", asMETHOD(ScriptActorWrapper, asPlaySfx), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
- r = engine->RegisterObjectMethod(AsClassNameInternal, "void SetAnimation(const string &in)", asMETHOD(ScriptActorWrapper, asSetAnimation), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassNameInternal, "void SetAnimation(int)", asMETHOD(ScriptActorWrapper, asSetAnimationState), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = module->AddScriptSection("__" AsClassName, AsLibrary, countof(AsLibrary) - 1, 0); RETURN_ASSERT(r >= 0);
@@ -597,11 +596,6 @@ shared abstract class CollectibleBase : )" AsClassName R"(
PlaySfx(identifier, gain, pitch);
}
- void ScriptActorWrapper::asSetAnimation(const String& identifier)
- {
- SetAnimation(identifier);
- }
-
void ScriptActorWrapper::asSetAnimationState(int state)
{
SetAnimation((AnimState)state);
diff --git a/Sources/Jazz2/Scripting/ScriptPlayerWrapper.cpp b/Sources/Jazz2/Scripting/ScriptPlayerWrapper.cpp
index 1c6a6b4e..1f8f5c2b 100644
--- a/Sources/Jazz2/Scripting/ScriptPlayerWrapper.cpp
+++ b/Sources/Jazz2/Scripting/ScriptPlayerWrapper.cpp
@@ -65,7 +65,6 @@ namespace Jazz2::Scripting
r = engine->RegisterObjectMethod(AsClassName, "void WarpTo(float, float)", asMETHOD(ScriptPlayerWrapper, asWarpTo), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassName, "void MoveBy(float, float)", asMETHOD(ScriptPlayerWrapper, asMoveBy), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassName, "void PlaySfx(const string &in, float = 1.0, float = 1.0)", asMETHOD(ScriptPlayerWrapper, asPlaySfx), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
- r = engine->RegisterObjectMethod(AsClassName, "void SetAnimation(const string &in)", asMETHOD(ScriptPlayerWrapper, asSetAnimation), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassName, "void SetAnimation(int)", asMETHOD(ScriptPlayerWrapper, asSetAnimationState), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
r = engine->RegisterObjectMethod(AsClassName, "void MorphTo(int)", asMETHOD(ScriptPlayerWrapper, asMorphTo), asCALL_THISCALL); RETURN_ASSERT(r >= 0);
@@ -227,13 +226,6 @@ namespace Jazz2::Scripting
}
}
- void ScriptPlayerWrapper::asSetAnimation(const String& identifier)
- {
- if (_player != nullptr) {
- _player->SetAnimation(identifier);
- }
- }
-
void ScriptPlayerWrapper::asSetAnimationState(int state)
{
if (_player != nullptr) {
diff --git a/Sources/Jazz2/UI/DiscordRpcClient.cpp b/Sources/Jazz2/UI/DiscordRpcClient.cpp
index 87f8003a..c55f22a2 100644
--- a/Sources/Jazz2/UI/DiscordRpcClient.cpp
+++ b/Sources/Jazz2/UI/DiscordRpcClient.cpp
@@ -75,7 +75,7 @@ namespace Jazz2::UI
return true;
}
- constexpr StringView RpcPaths[] = {
+ static const StringView RpcPaths[] = {
"%s/discord-ipc-%i"_s,
"%s/app/com.discordapp.Discord/discord-ipc-%i"_s,
"%s/snap.discord-canary/discord-ipc-%i"_s,
@@ -147,9 +147,8 @@ namespace Jazz2::UI
_hEventWrite = NULL;
}
#else
- int32_t sockFd = _sockFd;
+ int32_t sockFd = Interlocked::Exchange(&_sockFd, -1);
if (sockFd >= 0) {
- _sockFd = -1;
_thread.Abort();
::close(sockFd);
}
diff --git a/Sources/Jazz2/UI/HUD.cpp b/Sources/Jazz2/UI/HUD.cpp
index 9a3fd42a..ee32ca65 100644
--- a/Sources/Jazz2/UI/HUD.cpp
+++ b/Sources/Jazz2/UI/HUD.cpp
@@ -21,7 +21,7 @@ static constexpr uint8_t KeyLayout[] = {
namespace Jazz2::UI
{
HUD::HUD(LevelHandler* levelHandler)
- : _levelHandler(levelHandler), _graphics(nullptr), _levelTextTime(-1.0f), _coins(0), _gems(0), _coinsTime(-1.0f), _gemsTime(-1.0f),
+ : _levelHandler(levelHandler), _animations(nullptr), _levelTextTime(-1.0f), _coins(0), _gems(0), _coinsTime(-1.0f), _gemsTime(-1.0f),
_activeBossTime(0.0f), _touchButtonsTimer(0.0f), _rgbAmbientLight(0.0f), _rgbHealthLast(0.0f), _weaponWheelAnim(0.0f),
_weaponWheelShown(false), _lastWeaponWheelIndex(-1), _rgbLightsTime(0.0f), _transitionState(TransitionState::None),
_transitionTime(0.0f)
@@ -30,7 +30,7 @@ namespace Jazz2::UI
Metadata* metadata = resolver.RequestMetadata("UI/HUD"_s);
if (metadata != nullptr) {
- _graphics = &metadata->Graphics;
+ _animations = &metadata->Animations;
}
_smallFont = resolver.GetFont(FontType::Small);
@@ -142,7 +142,7 @@ namespace Jazz2::UI
{
Canvas::OnDraw(renderQueue);
- if (_graphics == nullptr) {
+ if (_animations == nullptr) {
return false;
}
@@ -273,8 +273,8 @@ namespace Jazz2::UI
_smallFont->DrawString(this, ammoCount, charOffset, right - 40.0f, bottom - 2.0f, FontLayer,
Alignment::BottomLeft, Font::DefaultColor, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.96f);
- auto it = _graphics->find(String::nullTerminatedView(currentWeaponString));
- if (it != _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(currentWeaponString));
+ if (it != _animations->end()) {
if (it->second.Base->FrameDimensions.Y < 20) {
pos.Y -= std::round((20 - it->second.Base->FrameDimensions.Y) * 0.5f);
}
@@ -651,8 +651,8 @@ namespace Jazz2::UI
void HUD::DrawElement(const StringView& name, int32_t frame, float x, float y, uint16_t z, Alignment align, const Colorf& color, float scaleX, float scaleY, bool additiveBlending, float angle)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -682,8 +682,8 @@ namespace Jazz2::UI
void HUD::DrawElementClipped(const StringView& name, int32_t frame, float x, float y, uint16_t z, Alignment align, const Colorf& color, float clipX, float clipY)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -782,8 +782,8 @@ namespace Jazz2::UI
return;
}
- auto it = _graphics->find(String::nullTerminatedView("WeaponWheel"_s));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView("WeaponWheel"_s));
+ if (it == _animations->end()) {
return;
}
@@ -1056,8 +1056,8 @@ namespace Jazz2::UI
info.Height = h * LevelHandler::DefaultWidth * 0.5f;
if (!identifier.empty()) {
- auto it = _graphics->find(String::nullTerminatedView(identifier));
- info.Graphics = (it != _graphics->end() ? &it->second : nullptr);
+ auto it = _animations->find(String::nullTerminatedView(identifier));
+ info.Graphics = (it != _animations->end() ? &it->second : nullptr);
} else {
info.Graphics = nullptr;
}
diff --git a/Sources/Jazz2/UI/HUD.h b/Sources/Jazz2/UI/HUD.h
index ea194295..ca1c72fd 100644
--- a/Sources/Jazz2/UI/HUD.h
+++ b/Sources/Jazz2/UI/HUD.h
@@ -82,7 +82,7 @@ namespace Jazz2::UI
static constexpr int32_t WeaponWheelMaxVertices = 512;
LevelHandler* _levelHandler;
- HashMap* _graphics;
+ HashMap* _animations;
std::shared_ptr _attachedPlayer;
Font* _smallFont;
diff --git a/Sources/Jazz2/UI/Menu/InGameMenu.cpp b/Sources/Jazz2/UI/Menu/InGameMenu.cpp
index 20751e6f..03494146 100644
--- a/Sources/Jazz2/UI/Menu/InGameMenu.cpp
+++ b/Sources/Jazz2/UI/Menu/InGameMenu.cpp
@@ -26,7 +26,7 @@ namespace Jazz2::UI::Menu
Metadata* metadata = resolver.RequestMetadata("UI/MainMenu"_s);
ASSERT_MSG(metadata != nullptr, "Cannot load required metadata");
- _graphics = &metadata->Graphics;
+ _animations = &metadata->Animations;
_sounds = &metadata->Sounds;
_smallFont = resolver.GetFont(FontType::Small);
@@ -272,8 +272,8 @@ namespace Jazz2::UI::Menu
void InGameMenu::DrawElement(const StringView& name, int32_t frame, float x, float y, uint16_t z, Alignment align, const Colorf& color, float scaleX, float scaleY, bool additiveBlending)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -304,8 +304,8 @@ namespace Jazz2::UI::Menu
void InGameMenu::DrawElement(const StringView& name, float x, float y, uint16_t z, Alignment align, const Colorf& color, const Vector2f& size, const Vector4f& texCoords)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -345,7 +345,7 @@ namespace Jazz2::UI::Menu
auto it = _sounds->find(String::nullTerminatedView(identifier));
if (it != _sounds->end()) {
int32_t idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int32_t)it->second.Buffers.size()) : 0);
- auto& player = _playingSounds.emplace_back(std::make_shared(it->second.Buffers[idx].get()));
+ auto& player = _playingSounds.emplace_back(std::make_shared(&it->second.Buffers[idx]->Buffer));
player->setPosition(Vector3f(0.0f, 0.0f, 100.0f));
player->setGain(gain * PreferencesCache::MasterVolume * PreferencesCache::SfxVolume);
player->setSourceRelative(true);
diff --git a/Sources/Jazz2/UI/Menu/InGameMenu.h b/Sources/Jazz2/UI/Menu/InGameMenu.h
index 7e759d09..36260e15 100644
--- a/Sources/Jazz2/UI/Menu/InGameMenu.h
+++ b/Sources/Jazz2/UI/Menu/InGameMenu.h
@@ -104,7 +104,7 @@ namespace Jazz2::UI::Menu
std::unique_ptr _canvasClipped;
std::unique_ptr _canvasOverlay;
ActiveCanvas _activeCanvas;
- HashMap* _graphics;
+ HashMap* _animations;
Font* _smallFont;
Font* _mediumFont;
diff --git a/Sources/Jazz2/UI/Menu/MainMenu.cpp b/Sources/Jazz2/UI/Menu/MainMenu.cpp
index 28b9b9c2..84eafe1e 100644
--- a/Sources/Jazz2/UI/Menu/MainMenu.cpp
+++ b/Sources/Jazz2/UI/Menu/MainMenu.cpp
@@ -30,7 +30,7 @@ namespace Jazz2::UI::Menu
Metadata* metadata = resolver.RequestMetadata("UI/MainMenu"_s);
ASSERT_MSG(metadata != nullptr, "Cannot load required metadata");
- _graphics = &metadata->Graphics;
+ _animations = &metadata->Animations;
_sounds = &metadata->Sounds;
_smallFont = resolver.GetFont(FontType::Small);
@@ -385,8 +385,8 @@ namespace Jazz2::UI::Menu
void MainMenu::DrawElement(const StringView& name, int32_t frame, float x, float y, uint16_t z, Alignment align, const Colorf& color, float scaleX, float scaleY, bool additiveBlending)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -417,8 +417,8 @@ namespace Jazz2::UI::Menu
void MainMenu::DrawElement(const StringView& name, float x, float y, uint16_t z, Alignment align, const Colorf& color, const Vector2f& size, const Vector4f& texCoords)
{
- auto it = _graphics->find(String::nullTerminatedView(name));
- if (it == _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView(name));
+ if (it == _animations->end()) {
return;
}
@@ -466,7 +466,7 @@ namespace Jazz2::UI::Menu
auto it = _sounds->find(String::nullTerminatedView(identifier));
if (it != _sounds->end()) {
int32_t idx = (it->second.Buffers.size() > 1 ? Random().Next(0, (int32_t)it->second.Buffers.size()) : 0);
- auto& player = _playingSounds.emplace_back(std::make_shared(it->second.Buffers[idx].get()));
+ auto& player = _playingSounds.emplace_back(std::make_shared(&it->second.Buffers[idx]->Buffer));
player->setPosition(Vector3f(0.0f, 0.0f, 100.0f));
player->setGain(gain * PreferencesCache::MasterVolume * PreferencesCache::SfxVolume);
player->setSourceRelative(true);
@@ -599,8 +599,8 @@ namespace Jazz2::UI::Menu
Vector2f debrisPos = Vector2f(Random().FastFloat(viewSize.X * -0.8f, viewSize.X * 0.8f),
Random().NextFloat(viewSize.Y * 0.5f, viewSize.Y * 1.0f));
- auto it = _graphics->find(String::nullTerminatedView("Snow"_s));
- if (it != _graphics->end()) {
+ auto it = _animations->find(String::nullTerminatedView("Snow"_s));
+ if (it != _animations->end()) {
auto& resBase = it->second.Base;
Vector2i texSize = resBase->TextureDiffuse->size();
float scale = Random().FastFloat(0.4f, 1.1f);
diff --git a/Sources/Jazz2/UI/Menu/MainMenu.h b/Sources/Jazz2/UI/Menu/MainMenu.h
index f5b0edb9..e3232b15 100644
--- a/Sources/Jazz2/UI/Menu/MainMenu.h
+++ b/Sources/Jazz2/UI/Menu/MainMenu.h
@@ -157,7 +157,7 @@ namespace Jazz2::UI::Menu
std::unique_ptr _canvasClipped;
std::unique_ptr _canvasOverlay;
ActiveCanvas _activeCanvas;
- HashMap* _graphics;
+ HashMap* _animations;
Font* _smallFont;
Font* _mediumFont;
diff --git a/Sources/Jazz2/UI/Menu/StartGameOptionsSection.cpp b/Sources/Jazz2/UI/Menu/StartGameOptionsSection.cpp
index f802726c..98a89d45 100644
--- a/Sources/Jazz2/UI/Menu/StartGameOptionsSection.cpp
+++ b/Sources/Jazz2/UI/Menu/StartGameOptionsSection.cpp
@@ -26,7 +26,7 @@ namespace Jazz2::UI::Menu
_animation = 0.0f;
if (auto mainMenu = dynamic_cast(_root)) {
- _availableCharacters = (mainMenu->_graphics->find(String::nullTerminatedView("MenuDifficultyLori"_s)) != mainMenu->_graphics->end() ? 3 : 2);
+ _availableCharacters = (mainMenu->_animations->find(String::nullTerminatedView("MenuDifficultyLori"_s)) != mainMenu->_animations->end() ? 3 : 2);
}
}
diff --git a/Sources/Main.cpp b/Sources/Main.cpp
index 8b4831c6..fae0fd27 100644
--- a/Sources/Main.cpp
+++ b/Sources/Main.cpp
@@ -732,8 +732,8 @@ void GameEventHandler::RefreshCache()
WriteCacheDescriptor(cachePath, currentVersion, animsModified);
- LOGI("Pruning binary shader cache...");
- RenderResources::binaryShaderCache().prune();
+ std::uint32_t filesRemoved = RenderResources::binaryShaderCache().prune();
+ LOGI("Pruning binary shader cache (removed %u files)...", filesRemoved);
} else {
LOGI("Cache is already up-to-date");
}
@@ -768,8 +768,8 @@ void GameEventHandler::RefreshCache()
std::int64_t animsModified = fs::GetLastModificationTime(animsPath).GetValue();
WriteCacheDescriptor(cachePath, currentVersion, animsModified);
- LOGI("Pruning binary shader cache...");
- RenderResources::binaryShaderCache().prune();
+ std::uint32_t filesRemoved = RenderResources::binaryShaderCache().prune();
+ LOGI("Pruning binary shader cache (removed %u files)...", filesRemoved);
_flags |= Flags::IsVerified | Flags::IsPlayable;
}
@@ -998,6 +998,7 @@ void GameEventHandler::RefreshCacheLevels()
}
// Convert only used tilesets
+ LOGI("Converting used tilesets...");
String tilesetsPath = fs::CombinePath(resolver.GetCachePath(), "Tilesets"_s);
fs::RemoveDirectoryRecursive(tilesetsPath);
fs::CreateDirectories(tilesetsPath);
diff --git a/Sources/Shared/IO/FileSystem.cpp b/Sources/Shared/IO/FileSystem.cpp
index b3c11a22..3edd7c05 100644
--- a/Sources/Shared/IO/FileSystem.cpp
+++ b/Sources/Shared/IO/FileSystem.cpp
@@ -387,6 +387,15 @@ namespace Death::IO
String FileSystem::_savePath;
FileSystem::Directory::Directory(const StringView& path, EnumerationOptions options)
+ : _fileNamePart(nullptr)
+#if defined(DEATH_TARGET_WINDOWS)
+ , _firstFile(true), _hFindFile(NULL)
+#else
+# if defined(DEATH_TARGET_ANDROID)
+ , _assetDir(nullptr)
+# endif
+ , _dirStream(nullptr)
+#endif
{
Open(path, options);
}
@@ -451,31 +460,31 @@ namespace Death::IO
return (_hFindFile != NULL && _hFindFile != INVALID_HANDLE_VALUE);
#else
auto nullTerminatedPath = String::nullTerminatedView(path);
+ if (!nullTerminatedPath.empty()) {
# if defined(DEATH_TARGET_ANDROID)
- const char* assetPath = AndroidAssetStream::TryGetAssetPath(nullTerminatedPath.data());
- if (assetPath != nullptr) {
- // It probably supports only files
- if ((_options & EnumerationOptions::SkipFiles) == EnumerationOptions::SkipFiles) {
- return false;
- }
- _assetDir = AndroidAssetStream::OpenDirectory(assetPath);
- if (_assetDir != nullptr) {
- std::size_t pathLength = path.size();
- std::memcpy(_path, path.data(), pathLength);
- if (_path[pathLength - 1] == '/' || _path[pathLength - 1] == '\\') {
- _path[pathLength - 1] = '/';
- _path[pathLength] = '\0';
- _fileNamePart = _path + pathLength;
- } else {
- _path[pathLength] = '/';
- _path[pathLength + 1] = '\0';
- _fileNamePart = _path + pathLength + 1;
+ const char* assetPath = AndroidAssetStream::TryGetAssetPath(nullTerminatedPath.data());
+ if (assetPath != nullptr) {
+ // It probably supports only files
+ if ((_options & EnumerationOptions::SkipFiles) != EnumerationOptions::SkipFiles) {
+ _assetDir = AndroidAssetStream::OpenDirectory(assetPath);
+ if (_assetDir != nullptr) {
+ std::size_t pathLength = path.size();
+ std::memcpy(_path, path.data(), pathLength);
+ if (_path[pathLength - 1] == '/' || _path[pathLength - 1] == '\\') {
+ _path[pathLength - 1] = '/';
+ _path[pathLength] = '\0';
+ _fileNamePart = _path + pathLength;
+ } else {
+ _path[pathLength] = '/';
+ _path[pathLength + 1] = '\0';
+ _fileNamePart = _path + pathLength + 1;
+ }
+ return true;
+ }
}
- return true;
+ return false;
}
- } else
# endif
- if (!nullTerminatedPath.empty()) {
_dirStream = ::opendir(nullTerminatedPath.data());
if (_dirStream != nullptr) {
String absPath = GetAbsolutePath(path);
diff --git a/Sources/Shared/IO/FileSystem.h b/Sources/Shared/IO/FileSystem.h
index 923cf379..1dfebf0b 100644
--- a/Sources/Shared/IO/FileSystem.h
+++ b/Sources/Shared/IO/FileSystem.h
@@ -95,15 +95,15 @@ namespace Death::IO
EnumerationOptions _options;
char _path[MaxPathLength];
- char* _fileNamePart = nullptr;
+ char* _fileNamePart;
#if defined(DEATH_TARGET_WINDOWS)
- bool _firstFile = true;
- void* _hFindFile = NULL;
+ bool _firstFile;
+ void* _hFindFile;
#else
# if defined(DEATH_TARGET_ANDROID)
- AAssetDir* _assetDir = nullptr;
+ AAssetDir* _assetDir;
# endif
- DIR* _dirStream = nullptr;
+ DIR* _dirStream;
#endif
};
diff --git a/Sources/Shared/IO/Stream.cpp b/Sources/Shared/IO/Stream.cpp
new file mode 100644
index 00000000..4d0aa86c
--- /dev/null
+++ b/Sources/Shared/IO/Stream.cpp
@@ -0,0 +1,93 @@
+#include "Stream.h"
+
+namespace Death::IO
+{
+ Containers::StringView Stream::GetPath() const
+ {
+ return _path;
+ }
+
+ std::int32_t Stream::ReadVariableInt32()
+ {
+ std::uint32_t n = ReadVariableUint32();
+ return (std::int32_t)(n >> 1) ^ -(std::int32_t)(n & 1);
+ }
+
+ std::int64_t Stream::ReadVariableInt64()
+ {
+ std::uint64_t n = ReadVariableUint64();
+ return (std::int64_t)(n >> 1) ^ -(std::int64_t)(n & 1);
+ }
+
+ std::uint32_t Stream::ReadVariableUint32()
+ {
+ std::int32_t pos = GetPosition();
+ std::uint32_t result = 0;
+ std::uint32_t shift = 0;
+ while (pos < _size) {
+ std::uint8_t byte = ReadValue();
+ result |= (byte & 0x7f) << shift;
+ shift += 7;
+ if ((byte & 0x80) == 0) {
+ break;
+ }
+ pos++;
+ }
+ return result;
+ }
+
+ std::uint64_t Stream::ReadVariableUint64()
+ {
+ std::int32_t pos = GetPosition();
+ std::uint64_t result = 0;
+ std::uint64_t shift = 0;
+ while (pos < _size) {
+ std::uint8_t byte = ReadValue();
+ result |= (byte & 0x7f) << shift;
+ shift += 7;
+ if ((byte & 0x80) == 0) {
+ break;
+ }
+ pos++;
+ }
+ return result;
+ }
+
+ std::int32_t Stream::WriteVariableInt32(std::int32_t value)
+ {
+ std::uint32_t n = (std::uint32_t)(value << 1) ^ (std::uint32_t)(value >> 31);
+ return WriteVariableUint32(n);
+ }
+
+ std::int32_t Stream::WriteVariableInt64(std::int64_t value)
+ {
+ std::uint64_t n = (std::uint64_t)(value << 1) ^ (std::uint64_t)(value >> 63);
+ return WriteVariableUint64(n);
+ }
+
+ std::int32_t Stream::WriteVariableUint32(std::uint32_t value)
+ {
+ std::int32_t bytesWritten = 1;
+ std::uint32_t valueLeft = value;
+ while (valueLeft >= 0x80) {
+ WriteValue((std::uint8_t)(valueLeft | 0x80));
+ valueLeft = valueLeft >> 7;
+ bytesWritten++;
+ }
+ WriteValue((std::uint8_t)valueLeft);
+ return bytesWritten;
+ }
+
+ std::int32_t Stream::WriteVariableUint64(std::uint64_t value)
+ {
+ std::int32_t bytesWritten = 1;
+ std::uint64_t valueLeft = value;
+ while (valueLeft >= 0x80) {
+ WriteValue((std::uint8_t)(valueLeft | 0x80));
+ valueLeft = valueLeft >> 7;
+ bytesWritten++;
+ }
+ WriteValue((std::uint8_t)valueLeft);
+ return bytesWritten;
+ }
+}
\ No newline at end of file
diff --git a/Sources/Shared/IO/Stream.h b/Sources/Shared/IO/Stream.h
index 12ffcb5d..7882da2f 100644
--- a/Sources/Shared/IO/Stream.h
+++ b/Sources/Shared/IO/Stream.h
@@ -61,9 +61,7 @@ namespace Death::IO
virtual bool IsValid() const = 0;
/** @brief Returns file path if any */
- Containers::StringView GetPath() const {
- return _path;
- }
+ Containers::StringView GetPath() const;
/** @brief Returns stream size in bytes */
DEATH_ALWAYS_INLINE std::int32_t GetSize() const {
@@ -86,89 +84,15 @@ namespace Death::IO
Write(&value, sizeof(T));
}
- std::int32_t ReadVariableInt32()
- {
- std::uint32_t n = ReadVariableUint32();
- return (std::int32_t)(n >> 1) ^ -(std::int32_t)(n & 1);
- }
-
- std::int64_t ReadVariableInt64()
- {
- std::uint64_t n = ReadVariableUint64();
- return (std::int64_t)(n >> 1) ^ -(std::int64_t)(n & 1);
- }
-
- std::uint32_t ReadVariableUint32()
- {
- std::int32_t pos = GetPosition();
- std::uint32_t result = 0;
- std::uint32_t shift = 0;
- while (pos < _size) {
- std::uint8_t byte = ReadValue();
- result |= (byte & 0x7f) << shift;
- shift += 7;
- if ((byte & 0x80) == 0) {
- break;
- }
- pos++;
- }
- return result;
- }
-
- std::uint64_t ReadVariableUint64()
- {
- std::int32_t pos = GetPosition();
- std::uint64_t result = 0;
- std::uint64_t shift = 0;
- while (pos < _size) {
- std::uint8_t byte = ReadValue();
- result |= (byte & 0x7f) << shift;
- shift += 7;
- if ((byte & 0x80) == 0) {
- break;
- }
- pos++;
- }
- return result;
- }
+ std::int32_t ReadVariableInt32();
+ std::int64_t ReadVariableInt64();
+ std::uint32_t ReadVariableUint32();
+ std::uint64_t ReadVariableUint64();
- std::int32_t WriteVariableInt32(std::int32_t value)
- {
- std::uint32_t n = (std::uint32_t)(value << 1) ^ (std::uint32_t)(value >> 31);
- return WriteVariableUint32(n);
- }
-
- std::int32_t WriteVariableInt64(std::int64_t value)
- {
- std::uint64_t n = (std::uint64_t)(value << 1) ^ (std::uint64_t)(value >> 63);
- return WriteVariableUint64(n);
- }
-
- std::int32_t WriteVariableUint32(std::uint32_t value)
- {
- std::int32_t bytesWritten = 1;
- std::uint32_t valueLeft = value;
- while (valueLeft >= 0x80) {
- WriteValue((std::uint8_t)(valueLeft | 0x80));
- valueLeft = valueLeft >> 7;
- bytesWritten++;
- }
- WriteValue((std::uint8_t)valueLeft);
- return bytesWritten;
- }
-
- std::int32_t WriteVariableUint64(std::uint64_t value)
- {
- std::int32_t bytesWritten = 1;
- std::uint64_t valueLeft = value;
- while (valueLeft >= 0x80) {
- WriteValue((std::uint8_t)(valueLeft | 0x80));
- valueLeft = valueLeft >> 7;
- bytesWritten++;
- }
- WriteValue((std::uint8_t)valueLeft);
- return bytesWritten;
- }
+ std::int32_t WriteVariableInt32(std::int32_t value);
+ std::int32_t WriteVariableInt64(std::int64_t value);
+ std::int32_t WriteVariableUint32(std::uint32_t value);
+ std::int32_t WriteVariableUint64(std::uint64_t value);
#if defined(DEATH_TARGET_BIG_ENDIAN)
DEATH_ALWAYS_INLINE static std::uint16_t Uint16FromBE(std::uint16_t value)
diff --git a/Sources/nCine/Graphics/BinaryShaderCache.cpp b/Sources/nCine/Graphics/BinaryShaderCache.cpp
index 2bf2d10c..ce7b6447 100644
--- a/Sources/nCine/Graphics/BinaryShaderCache.cpp
+++ b/Sources/nCine/Graphics/BinaryShaderCache.cpp
@@ -177,12 +177,9 @@ namespace nCine
return true;
}
- void BinaryShaderCache::prune()
+ std::uint32_t BinaryShaderCache::prune()
{
- if (path_.empty()) {
- return;
- }
-
+ std::uint32_t filesRemoved = 0;
fs::Directory dir(path_);
while (const StringView shaderPath = dir.GetNext()) {
if (fs::GetExtension(shaderPath) != "shader"_s) {
@@ -205,16 +202,16 @@ namespace nCine
if (shouldRemove) {
fs::RemoveFile(shaderPath);
+ filesRemoved++;
}
}
+
+ return filesRemoved;
}
- void BinaryShaderCache::clear()
+ std::uint32_t BinaryShaderCache::clear()
{
- if (path_.empty()) {
- return;
- }
-
+ std::uint32_t filesRemoved = 0;
fs::Directory dir(path_);
while (const StringView shaderPath = dir.GetNext()) {
if (fs::GetExtension(shaderPath) != "shader"_s) {
@@ -222,7 +219,10 @@ namespace nCine
}
fs::RemoveFile(shaderPath);
+ filesRemoved++;
}
+
+ return filesRemoved;
}
bool BinaryShaderCache::setPath(const StringView& path)
diff --git a/Sources/nCine/Graphics/BinaryShaderCache.h b/Sources/nCine/Graphics/BinaryShaderCache.h
index bdb418fe..f22bb84d 100644
--- a/Sources/nCine/Graphics/BinaryShaderCache.h
+++ b/Sources/nCine/Graphics/BinaryShaderCache.h
@@ -35,9 +35,9 @@ namespace nCine
bool saveToCache(const char* shaderName, std::uint64_t shaderVersion, GLShaderProgram* program);
/// Deletes all binary shaders that not belong to this platform from the cache directory
- void prune();
+ std::uint32_t prune();
/// Deletes all binary shaders from the cache directory
- void clear();
+ std::uint32_t clear();
/// Returns the current cache directory for binary shaders
inline const StringView path() {
diff --git a/cmake/ncine_sources.cmake b/cmake/ncine_sources.cmake
index e6fcbfbe..d9012ebb 100644
--- a/cmake/ncine_sources.cmake
+++ b/cmake/ncine_sources.cmake
@@ -10,6 +10,7 @@ set(SOURCES
${NCINE_SOURCE_DIR}/Shared/IO/FileStream.cpp
${NCINE_SOURCE_DIR}/Shared/IO/FileSystem.cpp
${NCINE_SOURCE_DIR}/Shared/IO/MemoryStream.cpp
+ ${NCINE_SOURCE_DIR}/Shared/IO/Stream.cpp
)
list(APPEND SOURCES