mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th05] Bullets: Sprite selection for angled bullets
Hopelessly hardcoded. Part of P0184, funded by -Tom-.
This commit is contained in:
parent
8ff719da91
commit
9471e133e9
|
@ -164,11 +164,14 @@ static const subpixel_t BULLET_KILLBOX_H = TO_SP(8);
|
||||||
# define PELLET_COUNT 180
|
# define PELLET_COUNT 180
|
||||||
# define BULLET16_COUNT 220
|
# define BULLET16_COUNT 220
|
||||||
|
|
||||||
// Returns the patnum for the directional or vector bullet sprite starting at
|
// Returns the sprite ID of a directional or vector bullet sprite that
|
||||||
// [patnum_base] that shows the given [angle].
|
// represents the given [angle], relative to [patnum_base]. While the function
|
||||||
int pascal near bullet_patnum_for_angle(int patnum_base, unsigned char angle);
|
// is technically not restricted to `main_patnum_t` in TH05 and can also be
|
||||||
// Updates [bullet]'s patnum based on its current angle.
|
// used for a general (angle / BULLET_D_CELS) division, it still assumes
|
||||||
void pascal near bullet_update_patnum(bullet_t near &bullet);
|
// [patnum_base] to be that type in order to distinguish vector bullets.
|
||||||
|
unsigned char pascal near bullet_patnum_for_angle(
|
||||||
|
int patnum_base, unsigned char angle
|
||||||
|
);
|
||||||
|
|
||||||
// Turns every 4th bullet into a point item when zapping bullets.
|
// Turns every 4th bullet into a point item when zapping bullets.
|
||||||
extern bool bullet_zap_drop_point_items;
|
extern bool bullet_zap_drop_point_items;
|
||||||
|
|
|
@ -30,6 +30,26 @@ extern "C" {
|
||||||
#include "th05/sprites/main_pat.h"
|
#include "th05/sprites/main_pat.h"
|
||||||
|
|
||||||
static const int SLOWDOWN_BULLET_THRESHOLD_UNUSED = 32;
|
static const int SLOWDOWN_BULLET_THRESHOLD_UNUSED = 32;
|
||||||
|
|
||||||
|
// Updates [bullet]'s patnum based on its current angle.
|
||||||
|
void pascal near bullet_update_patnum(bullet_t near &bullet)
|
||||||
|
{
|
||||||
|
unsigned char patnum_base; // main_patnum_t, obviously
|
||||||
|
|
||||||
|
if(bullet.patnum < PAT_BULLET16_D) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(bullet.patnum < (PAT_BULLET16_D_BLUE_last + 1)) {
|
||||||
|
patnum_base = PAT_BULLET16_D_BLUE;
|
||||||
|
} else if(bullet.patnum < (PAT_BULLET16_D_GREEN_last + 1)) {
|
||||||
|
patnum_base = PAT_BULLET16_D_GREEN;
|
||||||
|
} else if(bullet.patnum < (PAT_BULLET16_V_RED_last + 1)) {
|
||||||
|
patnum_base = PAT_BULLET16_V_RED;
|
||||||
|
} else {
|
||||||
|
patnum_base = PAT_BULLET16_V_BLUE;
|
||||||
|
}
|
||||||
|
bullet.patnum = bullet_patnum_for_angle(patnum_base, bullet.angle);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#include "th04/sprites/main_pat.h"
|
#include "th04/sprites/main_pat.h"
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
public BULLET_UPDATE_PATNUM
|
|
||||||
bullet_update_patnum proc near
|
|
||||||
|
|
||||||
@@patnum_base = byte ptr -1
|
|
||||||
@@bullet = word ptr 4
|
|
||||||
|
|
||||||
push bp
|
|
||||||
mov bp, sp
|
|
||||||
sub sp, 2
|
|
||||||
push si
|
|
||||||
mov si, [bp+@@bullet]
|
|
||||||
cmp [si+bullet_t.BULLET_patnum], PAT_BULLET16_D_BLUE
|
|
||||||
jl short @@ret
|
|
||||||
cmp [si+bullet_t.BULLET_patnum], PAT_BULLET16_D_GREEN
|
|
||||||
jge short @@d_green?
|
|
||||||
mov [bp+@@patnum_base], PAT_BULLET16_D_BLUE
|
|
||||||
jmp short @@set
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@@d_green?:
|
|
||||||
cmp [si+bullet_t.BULLET_patnum], PAT_BULLET16_V_RED
|
|
||||||
jge short @@v_red?
|
|
||||||
mov [bp+@@patnum_base], PAT_BULLET16_D_GREEN
|
|
||||||
jmp short @@set
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@@v_red?:
|
|
||||||
cmp [si+bullet_t.BULLET_patnum], PAT_BULLET16_V_BLUE
|
|
||||||
jge short @@v_blue?
|
|
||||||
mov [bp+@@patnum_base], PAT_BULLET16_V_RED
|
|
||||||
jmp short @@set
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@@v_blue?:
|
|
||||||
mov [bp+@@patnum_base], PAT_BULLET16_V_BLUE
|
|
||||||
|
|
||||||
@@set:
|
|
||||||
mov al, [bp+@@patnum_base]
|
|
||||||
mov ah, 0
|
|
||||||
call bullet_patnum_for_angle pascal, ax, word ptr [si+bullet_t.BULLET_angle]
|
|
||||||
mov ah, 0
|
|
||||||
mov [si+bullet_t.BULLET_patnum], ax
|
|
||||||
|
|
||||||
@@ret:
|
|
||||||
pop si
|
|
||||||
leave
|
|
||||||
retn 2
|
|
||||||
bullet_update_patnum endp
|
|
|
@ -11594,7 +11594,6 @@ loc_178A5:
|
||||||
curvebullets_update endp
|
curvebullets_update endp
|
||||||
|
|
||||||
include th04/main/item/splashes_update.asm
|
include th04/main/item/splashes_update.asm
|
||||||
include th05/main/bullet/update_patnum.asm
|
|
||||||
extern _bullets_update:proc
|
extern _bullets_update:proc
|
||||||
main_033_TEXT ends
|
main_033_TEXT ends
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue