Files
RustRaptor/raptor/src/shots.h
T
raptorreplica 214789fe87 Fork the vendored engine into the playable replica
Engine changes vs the vendored upstream (full ledger in
docs/upstream-patches.md):

- Assets: replace the encrypted FILE000N.GLB archives with a catalog of
  pre-decrypted loose files (data/INDEX); GLB_SlotItems() drives
  mission-pack / registered-version detection; payloads never run the
  GLB cipher at runtime.
- Platform: Linux/SDL2/ALSA only; Android, MSVC/MinGW, macOS packaging,
  bundled Windows SDL2 SDKs and the ENDOOM exit screen are gone;
  EXIT_Error now prints before exiting.
- Rendering: decouple presentation from simulation -- sim stays at the
  original 70/3 Hz, frames render interpolated at display rate (player,
  map scroll, enemies, shots, bonuses, anims, shadows); menus keep 70 Hz
  pacing; vsync with a delay-guard fallback.
- QoL: borderless window mode (Video/borderless), no menu cursor
  snapping onto default buttons.

Fix four regressions from the render split:

- Shield bars never redrew: RAP_ThinkStats latches g_oldshield each sim
  step before RAP_DisplayStats' dirty check could fire. Bars now draw
  unconditionally per rendered frame; g_oldsuper deleted, g_oldshield
  kept as sim-side damage-detection state only.
- Dying ships despawned without exploding: the render loop never called
  ANIMS_DisplayHigh(); most air-death explosions register HIGH_AIR.
  Restored between the player and enemy shots, as upstream orders it.
- Laser turret broke: reusing doneflag as a draw marker (it is
  hit/retire game state, and the turret retire path never frees its
  shot) hid the beam on hitting ticks and leaked one SHOTS pool slot
  per fire until no weapon could shoot. S_LINE tracers now carry an age
  counter: one Think pass, every render of their birth step, purged at
  the top of the next Think.
- Muzzle flash was cleared per rendered frame, making it invisible at
  display refresh rates; now cleared once per simulation step.
2026-08-26 18:45:07 +10:00

80 lines
2.8 KiB
C

#pragma once
#include "rap.h"
#include "gfxapi.h"
#define MAX_SHOTS 70
typedef enum
{
S_ALL,
S_AIR,
S_GROUND,
S_GRALL,
S_GTILE,
S_SUCK
}HIT_TYPE;
typedef enum
{
S_SHOOT,
S_LINE,
S_BEAM
}BEAM_TYPE;
typedef struct
{
int lumpnum; // LUMPNUM OF PIC(S)
char *pic[10]; // POINTER TO PIC
int shadow; // SHADOW ON/OFF
int type; // SHOT TYPE
int hits; // DAMAGE SHOT WILL DO
int speed; // START SPEED
int maxspeed; // MAXIMUM SPEED
int startframe; // START ANIM ON FRAME
int numframes; // NUMBER OF FRAMES OF ANIM
int shoot_rate; // SHOOT EVERY (N) FRAMES
int cur_shoot; // HOLDS FRAME COUNT DOWN
int delayflag; // DEALAYED ANIM START
int smoke; // SMOKE TRAIL
int use_plot; // TRUE = PLOT X,Y ( SLOWER )
int move_flag; // DOES SHOT NEED MOVEMENT
int ht; // SHOT HIT TYPE ( AIR/GROUND )
int fplrx; // FOLLOW PLAYER X POS
int fplry; // FOLLOW PLAYER Y POS
int meffect; // TRACK MOVE TO FIND HIT ?
int beam; // BEAM WEAPON TYPE
GFX_PIC *h;
int hlx;
int hly;
}SHOT_LIB;
typedef struct SHOTS_S
{
struct SHOTS_S *prev; // Link List Prev
struct SHOTS_S *next; // Link List Next
char *pic; // pointer to cur frame pic
int x; // cur shot center x
int y; // cur shot center y
int px; // prev sim x (interp)
int py; // prev sim y (interp)
MOVEOBJ move; // MOVE stuff
int speed; // cur speed
int curframe; // current anim frame
int doneflag; // shot done = TRUE
int delayflag; // DEALAYED ANIM START
int startx; // PLAYER X OFFSET;
int starty; // PLAYER Y OFFSET;
SHOT_LIB *lib;
int cnt;
int age; // sim steps survived (S_LINE purge in SHOTS_Think)
}SHOTS;
extern char *lashit[4];
int SHOTS_PlayerShoot(int type);
void SHOTS_Clear(void);
void SHOTS_Think(void);
void SHOTS_Display(void);
void SHOTS_Init(void);