2020-08-15 12:54:42 +00:00
|
|
|
.386
|
|
|
|
locals
|
|
|
|
|
|
|
|
include libs/master.lib/macros.inc
|
|
|
|
include th04/math/motion.inc
|
2021-05-25 16:22:48 +00:00
|
|
|
include th05/main/bullet/types.inc
|
2020-08-15 12:54:42 +00:00
|
|
|
include th04/main/bullet/bullet.inc
|
|
|
|
|
|
|
|
MAIN_03 group MAIN_031_TEXT
|
|
|
|
|
|
|
|
extrn _bullet_template:bullet_template_t
|
|
|
|
extrn _playperf:byte
|
|
|
|
|
|
|
|
; ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
MAIN_031_TEXT segment word public 'CODE' use16
|
|
|
|
assume cs:MAIN_03
|
|
|
|
|
|
|
|
tune proc
|
|
|
|
public TUNE_FOR_EASY
|
|
|
|
public TUNE_FOR_HARD
|
|
|
|
public TUNE_FOR_LUNATIC
|
|
|
|
|
|
|
|
; Local variable registers
|
|
|
|
; ------------------------
|
2021-05-25 16:22:48 +00:00
|
|
|
@@group_reg equ <bx>
|
|
|
|
@@group equ <bl>
|
2020-08-15 12:54:42 +00:00
|
|
|
|
2021-05-25 16:22:48 +00:00
|
|
|
@@group_table equ <cx>
|
2020-08-15 12:54:42 +00:00
|
|
|
|
|
|
|
@@spread_reg equ <ax>
|
|
|
|
@@spread equ <al>
|
|
|
|
@@spread_angle_delta equ <ah>
|
|
|
|
|
|
|
|
@@stack_reg equ <dx>
|
|
|
|
@@stack equ <dl>
|
|
|
|
@@stack_speed_delta equ <dh>
|
|
|
|
; ------------------------
|
|
|
|
|
|
|
|
TUNE_FOR_EASY label near
|
2021-05-25 16:22:48 +00:00
|
|
|
movzx @@group_reg, _bullet_template.BT_group
|
|
|
|
cmp @@group, BG_SPREAD
|
2020-08-15 12:54:42 +00:00
|
|
|
jb short @@easy_ret
|
2021-05-25 16:22:48 +00:00
|
|
|
cmp @@group, BG_RANDOM_ANGLE_AND_SPEED
|
2020-08-15 12:54:42 +00:00
|
|
|
ja short @@easy_ret
|
2021-05-25 16:22:48 +00:00
|
|
|
sub @@group, BG_SPREAD
|
2021-07-15 17:20:11 +00:00
|
|
|
mov @@group_table, offset MAIN_03:@@easy_group_table
|
2020-08-15 12:54:42 +00:00
|
|
|
jmp short @@set_vars_and_dispatch
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@easy_spread:
|
|
|
|
@@easy_spread_stack:
|
|
|
|
cmp @@spread, 3
|
|
|
|
jb short @@easy_ret
|
|
|
|
sub _bullet_template.spread, 2
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@easy_stack:
|
|
|
|
shr @@stack_speed_delta, 2
|
|
|
|
sub _bullet_template.stack_speed_delta, @@stack_speed_delta
|
|
|
|
|
|
|
|
; Since unused fields of the bullet template aren't typically reset, this
|
|
|
|
; translates to "delta of the last spread that was fired" - whenever that
|
|
|
|
; was. uth05win thought this is a bug and changed it to @@stack.
|
|
|
|
cmp @@spread_angle_delta, 2
|
|
|
|
jb short @@easy_ret
|
|
|
|
dec _bullet_template.BT_stack
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@easy_ring:
|
|
|
|
@@easy_ring_stack:
|
|
|
|
@@easy_random:
|
|
|
|
shr _bullet_template.spread, 1
|
|
|
|
|
|
|
|
@@easy_ret:
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
even
|
2021-05-25 16:22:48 +00:00
|
|
|
@@easy_group_table label word
|
2020-08-15 12:54:42 +00:00
|
|
|
dw offset @@easy_spread
|
|
|
|
dw offset @@easy_ring
|
|
|
|
dw offset @@easy_stack
|
|
|
|
dw offset @@easy_spread_stack
|
|
|
|
dw offset @@easy_ring_stack
|
|
|
|
dw offset @@easy_random
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TUNE_FOR_HARD label near
|
2021-05-25 16:22:48 +00:00
|
|
|
movzx @@group_reg, _bullet_template.BT_group
|
2020-08-15 12:54:42 +00:00
|
|
|
|
|
|
|
; "Well, I'd like to tune single bullets on Hard, but not spreads… so
|
|
|
|
; let's just handle single bullets outside the table dispatch! :zunpet:"
|
2021-05-25 16:22:48 +00:00
|
|
|
cmp @@group, BG_SINGLE_AIMED
|
2020-08-15 12:54:42 +00:00
|
|
|
jbe short @@hard_single
|
|
|
|
|
2021-05-25 16:22:48 +00:00
|
|
|
cmp @@group, BG_RING
|
2020-08-15 12:54:42 +00:00
|
|
|
jb short @@hard_ret
|
2021-05-25 16:22:48 +00:00
|
|
|
cmp @@group, BG_RANDOM_ANGLE_AND_SPEED
|
2020-08-15 12:54:42 +00:00
|
|
|
ja short @@hard_ret
|
2021-05-25 16:22:48 +00:00
|
|
|
sub @@group, BG_RING
|
2021-07-15 17:20:11 +00:00
|
|
|
mov @@group_table, offset MAIN_03:@@hard_group_table
|
2020-08-15 12:54:42 +00:00
|
|
|
|
|
|
|
@@set_vars_and_dispatch:
|
|
|
|
mov @@spread_reg, word ptr _bullet_template.spread
|
|
|
|
mov @@stack_reg, word ptr _bullet_template.BT_stack
|
2021-05-25 16:22:48 +00:00
|
|
|
and @@group, (not BGC0_AIMED)
|
|
|
|
add @@group_reg, @@group_table
|
|
|
|
jmp word ptr cs:[@@group_reg]
|
2020-08-15 12:54:42 +00:00
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@hard_single:
|
2021-05-25 16:22:48 +00:00
|
|
|
add _bullet_template.BT_group, BGCS_STACK
|
2020-08-15 12:54:42 +00:00
|
|
|
mov word ptr _bullet_template.BT_stack, (6 shl 8) or 2
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@hard_stack:
|
|
|
|
@@hard_spread_stack:
|
|
|
|
shr @@stack_speed_delta, 1
|
|
|
|
add _bullet_template.stack_speed_delta, @@stack_speed_delta
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@hard_ring:
|
|
|
|
@@hard_ring_stack:
|
|
|
|
shr @@spread, 2
|
|
|
|
cmp @@spread, 6
|
|
|
|
jbe short @@hard_add_to_spread
|
|
|
|
mov @@spread, 6
|
|
|
|
|
|
|
|
@@hard_add_to_spread:
|
|
|
|
add _bullet_template.spread, @@spread
|
|
|
|
|
|
|
|
@@hard_ret:
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@hard_random:
|
|
|
|
shr @@spread, 1
|
|
|
|
jmp short @@hard_add_to_spread
|
|
|
|
|
|
|
|
even
|
2021-05-25 16:22:48 +00:00
|
|
|
@@hard_group_table label word
|
2020-08-15 12:54:42 +00:00
|
|
|
dw offset @@hard_ring
|
|
|
|
dw offset @@hard_stack
|
|
|
|
dw offset @@hard_spread_stack
|
|
|
|
dw offset @@hard_ring_stack
|
|
|
|
dw offset @@hard_random
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TUNE_FOR_LUNATIC label near
|
2021-05-25 16:22:48 +00:00
|
|
|
movzx @@group_reg, _bullet_template.BT_group
|
|
|
|
cmp @@group, BG_RANDOM_ANGLE_AND_SPEED
|
2020-08-15 12:54:42 +00:00
|
|
|
ja short @@lunatic_ret
|
2021-07-15 17:20:11 +00:00
|
|
|
mov @@group_table, offset MAIN_03:@@lunatic_group_table
|
2020-08-15 12:54:42 +00:00
|
|
|
jmp short @@set_vars_and_dispatch
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@lunatic_single:
|
2021-05-25 16:22:48 +00:00
|
|
|
add _bullet_template.BT_group, BGCC_SPREAD
|
2020-08-15 12:54:42 +00:00
|
|
|
mov word ptr _bullet_template.spread, (6 shl 8) or 3
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@lunatic_stack:
|
|
|
|
shr @@stack_speed_delta, 1
|
|
|
|
add _bullet_template.stack_speed_delta, @@stack_speed_delta
|
|
|
|
inc _bullet_template.BT_stack
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@lunatic_spread:
|
|
|
|
@@lunatic_spread_stack:
|
|
|
|
add _bullet_template.spread, 2
|
|
|
|
retn
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@lunatic_ring:
|
|
|
|
@@lunatic_ring_stack:
|
|
|
|
; mov al, @@spread
|
|
|
|
xor ah, ah
|
|
|
|
mov dl, 3
|
|
|
|
div dl ; @@spread /= 3
|
|
|
|
cmp @@spread, 12
|
|
|
|
jbe short @@lunatic_add_to_spread
|
|
|
|
mov @@spread, 12
|
|
|
|
|
|
|
|
@@lunatic_add_to_spread:
|
|
|
|
@@lunatic_random:
|
|
|
|
add _bullet_template.spread, @@spread
|
|
|
|
|
|
|
|
@@lunatic_ret:
|
|
|
|
retn
|
|
|
|
|
|
|
|
even
|
2021-05-25 16:22:48 +00:00
|
|
|
@@lunatic_group_table label word
|
2020-08-15 12:54:42 +00:00
|
|
|
dw offset @@lunatic_single
|
|
|
|
dw offset @@lunatic_spread
|
|
|
|
dw offset @@lunatic_ring
|
|
|
|
dw offset @@lunatic_stack
|
|
|
|
dw offset @@lunatic_spread_stack
|
|
|
|
dw offset @@lunatic_ring_stack
|
|
|
|
dw offset @@lunatic_random
|
|
|
|
tune endp
|
|
|
|
MAIN_031_TEXT ends
|
|
|
|
|
|
|
|
end
|