mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th01] Bomb items: Spawn function
Part of P0158, funded by Yanga.
This commit is contained in:
parent
b75ee8c208
commit
b9bc6ac04d
|
@ -60,7 +60,7 @@ bin\th01\op.exe: bin\piloadc.obj bin\th01\op.obj th01\op_01.cpp bin\th01\frmdela
|
|||
$**
|
||||
|
|
||||
|
||||
bin\th01\reiiden.exe: bin\piloadc.obj bin\th01\reiiden.obj th01\main_01.cpp th01\main_01_.cpp bin\th01\frmdelay.obj bin\th01\vsync.obj bin\th01\ztext.obj bin\th01\initexit.obj bin\th01\graph.obj bin\th01\ptn_0to1.obj bin\th01\vplanset.obj th01\main_07.cpp bin\th01\ptn.obj th01\main_08.cpp bin\th01\grz.obj th01\main_09.cpp th01\grpinv32.cpp bin\th01\resstuff.obj th01\main_13.cpp th01\main_13_.cpp th01\main_14.cpp th01\main_15.cpp bin\th01\mdrv2.obj th01\main_19.cpp th01\main_20.cpp th01\main_21.cpp th01\main_23.cpp th01\main_25.cpp th01\main_26.cpp th01\main_27.cpp th01\main_29.cpp th01\main_30.cpp th01\main_31.cpp th01\main_32.cpp th01\main_33.cpp th01\main_34.cpp th01\main_35.cpp th01\main_36.cpp th01\main_37.cpp th01\main_38.cpp
|
||||
bin\th01\reiiden.exe: bin\piloadc.obj bin\th01\reiiden.obj th01\main_01.cpp th01\main_01_.cpp bin\th01\frmdelay.obj bin\th01\vsync.obj bin\th01\ztext.obj bin\th01\initexit.obj bin\th01\graph.obj bin\th01\ptn_0to1.obj bin\th01\vplanset.obj th01\main_07.cpp bin\th01\ptn.obj th01\main_08.cpp bin\th01\grz.obj th01\main_09.cpp th01\grpinv32.cpp bin\th01\resstuff.obj th01\main_13.cpp th01\main_13_.cpp th01\main_14.cpp th01\main_15.cpp bin\th01\mdrv2.obj th01\main_19.cpp th01\main_20.cpp th01\main_21.cpp th01\main_23.cpp th01\main_24.cpp th01\main_25.cpp th01\main_26.cpp th01\main_27.cpp th01\main_29.cpp th01\main_30.cpp th01\main_31.cpp th01\main_32.cpp th01\main_33.cpp th01\main_34.cpp th01\main_35.cpp th01\main_36.cpp th01\main_37.cpp th01\main_38.cpp
|
||||
$(CC) $(CFLAGS) $(LARGE_LFLAGS) -3 -Z -d -DGAME=1 -DBINARY='M' -nbin\th01\ -eREIIDEN.EXE @&&|
|
||||
$**
|
||||
|
|
||||
|
|
|
@ -2,8 +2,12 @@ extern "C" {
|
|||
#include "platform.h"
|
||||
#include "pc98.h"
|
||||
#include "planar.h"
|
||||
#include "th01/main/playfld.hpp"
|
||||
#include "th01/formats/ptn.hpp"
|
||||
#include "th01/formats/stagedat.hpp"
|
||||
#include "th01/main/stage/stageobj.hpp"
|
||||
}
|
||||
#include "th01/main/stage/item.hpp"
|
||||
|
||||
/// Constants
|
||||
/// ---------
|
||||
|
@ -48,3 +52,26 @@ static const int ITEM_POINT_COUNT = 10;
|
|||
extern item_t items_bomb[ITEM_BOMB_COUNT];
|
||||
extern item_t items_point[ITEM_POINT_COUNT];
|
||||
/// ----------
|
||||
|
||||
/// Helper functions
|
||||
/// ----------------
|
||||
|
||||
#define item_add(item, from_card_slot) { \
|
||||
item.flag = IF_SPLASH; \
|
||||
item.left = cards.left[from_card_slot]; \
|
||||
item.top = cards.top[from_card_slot]; \
|
||||
item.unknown_zero = 0; \
|
||||
item.velocity_y = 2; \
|
||||
item.flag_state.splash_radius = 4; \
|
||||
}
|
||||
/// ----------------
|
||||
|
||||
void items_bomb_add(int from_card_slot)
|
||||
{
|
||||
for(int i = 0; i < ITEM_BOMB_COUNT; i++) {
|
||||
if(items_bomb[i].flag == IF_FREE) {
|
||||
item_add(items_bomb[i], from_card_slot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
/// Bombs
|
||||
/// -----
|
||||
|
||||
// Spawns a new bomb item from the position of the card in the given slot.
|
||||
void items_bomb_add(int from_card_slot);
|
||||
/// -----
|
|
@ -0,0 +1,6 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* Code segment #24 of TH01's REIIDEN.EXE
|
||||
*/
|
||||
|
||||
#include "th01/main/stage/item.cpp"
|
|
@ -63,6 +63,7 @@ main_01 group main_01_TEXT, main_01__TEXT, main_01___TEXT
|
|||
main_15 group main_15_TEXT, main_15__TEXT
|
||||
main_19 group main_19_TEXT, main_19__TEXT
|
||||
main_21 group main_21_TEXT, main_21__TEXT
|
||||
main_24 group main_24_TEXT, main_24__TEXT
|
||||
main_25 group main_25_TEXT, main_25__TEXT
|
||||
main_27 group main_27_TEXT, main_27__TEXT
|
||||
main_29 group main_29_TEXT, main_29__TEXT
|
||||
|
@ -6041,7 +6042,11 @@ main_23_TEXT ends
|
|||
|
||||
; Segment type: Pure code
|
||||
main_24_TEXT segment byte public 'CODE' use16
|
||||
assume cs:main_24_TEXT
|
||||
extern @items_bomb_add$qi:proc
|
||||
main_24_TEXT ends
|
||||
|
||||
main_24__TEXT segment byte public 'CODE' use16
|
||||
assume cs:main_24
|
||||
;org 9
|
||||
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
|
||||
|
||||
|
@ -6054,69 +6059,6 @@ IF_COLLECTED_OVER_CAP = 100
|
|||
ITEM_W = PTN_W
|
||||
ITEM_H = PTN_H
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_17CA9 proc far
|
||||
|
||||
@@from_card_slot = word ptr 6
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov cx, [bp+@@from_card_slot]
|
||||
xor dx, dx
|
||||
jmp short loc_17D18
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_17CB3:
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
cmp _items_bomb.ITEM_flag[bx], IF_FREE
|
||||
jnz short loc_17D17
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_flag[bx], IF_SPLASH
|
||||
mov ax, cx
|
||||
add ax, ax
|
||||
les bx, _cards_left
|
||||
add bx, ax
|
||||
mov ax, es:[bx]
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_left[bx], ax
|
||||
mov ax, cx
|
||||
add ax, ax
|
||||
les bx, _cards_top
|
||||
add bx, ax
|
||||
mov ax, es:[bx]
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_top[bx], ax
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_unknown_zero[bx], 0
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_velocity_y[bx], 2
|
||||
mov bx, dx
|
||||
imul bx, size item_t
|
||||
mov _items_bomb.ITEM_splash_radius[bx], 4
|
||||
pop bp
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_17D17:
|
||||
inc dx
|
||||
|
||||
loc_17D18:
|
||||
cmp dx, ITEM_BOMB_COUNT
|
||||
jl short loc_17CB3
|
||||
pop bp
|
||||
retf
|
||||
sub_17CA9 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -6722,9 +6664,9 @@ loc_181B4:
|
|||
imul bx, size item_t
|
||||
cmp _items_bomb.ITEM_flag[bx], IF_FREE
|
||||
jz short loc_1820E
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_181A7
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_1802D
|
||||
push 20h ; ' '
|
||||
push ds
|
||||
|
@ -6747,7 +6689,7 @@ loc_181B4:
|
|||
imul ax, size item_t
|
||||
add ax, offset _items_bomb.ITEM_left
|
||||
push ax
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_17D1F
|
||||
push ds
|
||||
mov ax, si
|
||||
|
@ -7188,9 +7130,9 @@ loc_18526:
|
|||
imul bx, size item_t
|
||||
cmp _items_point.ITEM_flag[bx], IF_FREE
|
||||
jz short loc_18580
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_18456
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_18465
|
||||
push 21h ; '!'
|
||||
push ds
|
||||
|
@ -7213,7 +7155,7 @@ loc_18526:
|
|||
imul ax, size item_t
|
||||
add ax, offset _items_point.ITEM_left
|
||||
push ax
|
||||
push seg main_24_TEXT
|
||||
push seg main_24
|
||||
push offset sub_1828D
|
||||
push ds
|
||||
mov ax, si
|
||||
|
@ -7237,7 +7179,7 @@ loc_18584:
|
|||
retf
|
||||
sub_1851E endp
|
||||
|
||||
main_24_TEXT ends
|
||||
main_24__TEXT ends
|
||||
|
||||
; ===========================================================================
|
||||
|
||||
|
@ -17059,7 +17001,7 @@ loc_1FF67:
|
|||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_1FF6F:
|
||||
call sub_17CA9 pascal, si
|
||||
call @items_bomb_add$qi pascal, si
|
||||
|
||||
loc_1FF75:
|
||||
pop cx
|
||||
|
|
Loading…
Reference in New Issue