Objectif
Implementer la routine ASM Plr1_Shot (newplayershoot.s) de facon incrementale.
Phase 1.B = input + cooldown + consommation ammo + log du tir. Pas encore de
spawn de projectile visible (Phase 1.C).
Nouveaux composants
KeyBindings : config des bindings clavier/souris avec enum Action
(MOVE_*, FIRE, NEXT_WEAPON, WEAPON_1..8, DEBUG_HUD, etc.). Support pour
override a chaud via menu options (a venir). Defaults :
– FIRE : clic gauche souris
– WEAPON_1..8 : touches 1..8
– NEXT_WEAPON : Y / PREV_WEAPON : T
– MOVE : ZQSD + fleches (compatibilite avec l’existant)
PlayerCombatState : etat combat du joueur, conforme aux champs
PlrT_* de l’ASM :
– ammoCounts[20] (= PlrT_AmmoCounts_vw)
– weaponsOwned[10] (= PlrT_Weapons_vb)
– gunSelected (= PlrT_GunSelected_b)
– timeToShoot (= PlrT_TimeToShoot_w, en frames Amiga)
– fireHeld (= PlrT_Fire_b)
– Snapshot tmpGunSelected/tmpFire (= Tmp* ASM)
– Listener pattern pour notifier le changement d’arme (sync avec WeaponView)
PlayerShootSystem (AppState JME) : implemente Plr1_Shot ASM :
1. Input tick : snapshot de fire/gun
2. Cooldown : decremente timeToShoot avec framesAmigaDelta = tpf * 25
3. Si pret a tirer + fire actif + ammo suffisante : consomme ammo, applique
shoot.delay() en cooldown, log le tir
4. Si ammo insuffisante : log « plus d’ammo » + petit cooldown anti-spam
5. Selection d’arme via touches 1..8 / next / prev
Conversion temps : 25 Hz Amiga → tpf JME en secondes multiplie par
TICKS_PER_SECOND = 25 pour obtenir l’equivalent Anim_TempFrames_w.
CombatBootstrap : factory des defaults pour un nouveau niveau :
– 1 ammo par type de bullet utilise par les 8 vraies armes
– Les 8 armes possedees (0..7)
– Arme selectionnee : Shotgun (index 0)
Integration dans GameAppState
- Charge
TEST.LNKviaGlfDatabase.loadFromResource("TEST.LNK") - Cree le combat state via
CombatBootstrap.newLevelStart(glf) - Enregistre un listener sur
gunSelectedqui appelleweaponView.loadWeapon() - Attache le
PlayerShootSystem - Retire les bindings Y/T de GameAppState pour eviter le double-binding
avec le PlayerShootSystem (la selection d’arme devient la responsabilite
unique du combat system)
Fichiers crees/modifies
src/main/java/com/ab3d2/combat/KeyBindings.java(NEW)src/main/java/com/ab3d2/combat/PlayerCombatState.java(NEW)src/main/java/com/ab3d2/combat/PlayerShootSystem.java(NEW)src/main/java/com/ab3d2/combat/CombatBootstrap.java(NEW)src/main/java/com/ab3d2/app/GameAppState.java: integration combat system
Test attendu
- Lancer
./gradlew run, entrer dans un niveau - Clic gauche : log
"FIRE! Shotgun -> 2x Shotgun Round (hitscan) (ammo restant: 0) [cooldown 50 frames]" - Cooldown de ~2 secondes (50 frames / 25 Hz), puis log
"Click! Plus d'ammo pour Shotgun" - Touche 2 : log
"Arme -> 1 (Plasma Gun)", le modele en main change, le vectobj
plasmagun.j3os’affiche (si correctement copie et converti) - Clic gauche : tir de plasma (cooldown 10 frames = 0.4s)
Prochaine etape
Phase 1.C : creation de projectile. Spawn d’un Geometry simple (sphere
coloree) a la position du joueur + velocite dans la direction de visee, qui
se deplace chaque frame. Pour l’instant sans collision ni SFX.