diff --git a/Makefile.mak b/Makefile.mak index d6da7e39..2f0b8115 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -59,7 +59,7 @@ bin\th01\op.exe: bin\piloadc.obj bin\th01\op.obj th01\op_01.cpp th01\op_02.c th0 $** | -bin\th01\reiiden.exe: bin\piloadc.obj bin\th01\reiiden.obj th01\main_01.cpp th01\main_01_.cpp th01\main_02.c th01\main_03.c th01\main_04.c th01\main_05.c th01\main_06.cpp th01\main_07.cpp th01\main_08.cpp th01\main_12.c th01\main_13.cpp th01\main_13_.cpp th01\main_14.c th01\main_16.c th01\main_19.cpp th01\main_25.cpp th01\main_27.cpp th01\main_38.cpp th01\main_38_.cpp +bin\th01\reiiden.exe: bin\piloadc.obj bin\th01\reiiden.obj th01\main_01.cpp th01\main_01_.cpp th01\main_02.c th01\main_03.c th01\main_04.c th01\main_05.c th01\main_06.cpp th01\main_07.cpp th01\main_08.cpp th01\main_09.cpp th01\main_12.c th01\main_13.cpp th01\main_13_.cpp th01\main_14.c th01\main_16.c th01\main_19.cpp th01\main_25.cpp th01\main_27.cpp th01\main_38.cpp th01\main_38_.cpp $(CC) $(CFLAGS) -ml -3 -DGAME=1 -DBINARY='M' -nbin\th01\ -eREIIDEN.EXE @&&| $** | diff --git a/build32b.bat b/build32b.bat index c8f196b3..a81a69b0 100755 --- a/build32b.bat +++ b/build32b.bat @@ -28,6 +28,7 @@ set BMP2ARR=bin\Pipeline\bmp2arr.exe %CXX32% %CXX32FLAGS% -nbin/Pipeline/ Pipeline\bmp2arr.c Pipeline\bmp2arrl.c %BMP2ARR% -i th01/sprites/pellet.bmp -o th01/sprites/pellet.asp -sym _sPELLET -of asm -sw 8 -sh 8 -pshf inner +%BMP2ARR% -i th01/sprites/pellet_c.bmp -o th01/sprites/pellet_c.asp -sym _sPELLET_CLOUD -of asm -sw 16 -sh 16 %BMP2ARR% -i th02/sprites/pellet.bmp -o th02/sprites/pellet.asp -sym _sPELLET -of asm -sw 8 -sh 8 -pshf outer %BMP2ARR% -i th02/sprites/sparks.bmp -o th02/sprites/sparks.asp -sym _sSPARKS -of asm -sw 8 -sh 8 -pshf outer %BMP2ARR% -i th02/sprites/pointnum.bmp -o th02/sprites/pointnum.asp -sym _sPOINTNUMS -of asm -sw 8 -sh 8 diff --git a/planar.h b/planar.h index 3ca2db7e..64c824c6 100644 --- a/planar.h +++ b/planar.h @@ -93,6 +93,11 @@ static inline unsigned int vram_offset_muldiv(int x, int y) VRAM_PUT(G, offset, src.G, bit_count); \ VRAM_PUT(E, offset, src.E, bit_count); +#define vram_or_emptyopt(plane, offset, src, bit_count) \ + if(src) { \ + VRAM_CHUNK(plane, offset, bit_count) |= src; \ + } + #define vram_or_masked_emptyopt(plane, offset, bit_count, src, mask) \ if(src) { \ VRAM_CHUNK(plane, offset, bit_count) |= (src & mask); \ @@ -104,6 +109,11 @@ static inline unsigned int vram_offset_muldiv(int x, int y) VRAM_CHUNK(G, offset, bit_count) |= src.G; \ VRAM_CHUNK(E, offset, bit_count) |= src.E; +#define vram_or_planar_emptyopt(offset, src, bit_count) \ + vram_or_emptyopt(B, offset, src.B, bit_count); \ + vram_or_emptyopt(R, offset, src.R, bit_count); \ + vram_or_emptyopt(G, offset, src.G, bit_count); \ + vram_or_emptyopt(E, offset, src.E, bit_count); #define PLANE_DWORD_BLIT(dst, src) \ for(p = 0; p < PLANE_SIZE; p += (int)sizeof(dots32_t)) { \ diff --git a/th01/main/bullet/pellet_c.cpp b/th01/main/bullet/pellet_c.cpp new file mode 100644 index 00000000..3c1298fd --- /dev/null +++ b/th01/main/bullet/pellet_c.cpp @@ -0,0 +1,52 @@ +#pragma option -1 + +extern "C" { + +#include "platform.h" +#include "pc98.h" +#include "planar.h" +#include "th01/hardware/graph.h" +#include "th01/main/bullet/pellet_c.hpp" +#include "th01/sprites/pellet_c.h" + +void pellet_cloud_put_8(int left, int top, int col, int cel) +{ + uint16_t vram_offset = vram_offset_shift(left, top); + + grcg_setcolor_rmw(col); + + int y = 0; + while(y < PELLET_CLOUD_H) { + if(sPELLET_CLOUD[cel][y]) { + VRAM_PUT(B, vram_offset, sPELLET_CLOUD[cel][y], PELLET_CLOUD_W); + } + y++; + vram_offset += ROW_SIZE; + } + grcg_off(); +} + +void pellet_cloud_unput_8(int left, int top, int cel) +{ + planar_t(PELLET_CLOUD_W) page1; + uint16_t vram_offset = vram_offset_shift(left, top); + + pellet_cloud_put_8(left, top, 0, cel); + + int y = 0; + while(y < PELLET_CLOUD_H) { + if(sPELLET_CLOUD[cel][y]) { + graph_accesspage_func(1); + vram_snap_planar_masked( + page1, vram_offset, PELLET_CLOUD_W, sPELLET_CLOUD[cel][y] + ); + + graph_accesspage_func(0); + vram_or_planar_emptyopt(vram_offset, page1, PELLET_CLOUD_W); + } + y++; + vram_offset += ROW_SIZE; + } +} + +} diff --git a/th01/main/bullet/pellet_c.hpp b/th01/main/bullet/pellet_c.hpp new file mode 100644 index 00000000..c3000ffb --- /dev/null +++ b/th01/main/bullet/pellet_c.hpp @@ -0,0 +1,8 @@ +// Displays a pellet delay cloud [cel] in the given [col] at +// (⌊left/8⌋*8, top). +void pellet_cloud_put_8(int left, int top, int col, int cel); + +// Restores the pixels of the given pellet delay cloud [cel], starting at +// (⌊left/8⌋*8, top), from VRAM page 1, effectively removing a cloud that was +// previously blitted to that position. +void pellet_cloud_unput_8(int left, int top, int cel); diff --git a/th01/main_09.cpp b/th01/main_09.cpp new file mode 100644 index 00000000..ef0d7d9e --- /dev/null +++ b/th01/main_09.cpp @@ -0,0 +1,6 @@ +/* ReC98 + * ----- + * Code segment #9 of TH01's REIIDEN.EXE + */ + +#include "th01/main/bullet/pellet_c.cpp" diff --git a/th01/sprites/pellet_c.bmp b/th01/sprites/pellet_c.bmp new file mode 100644 index 00000000..e27ec5c0 Binary files /dev/null and b/th01/sprites/pellet_c.bmp differ diff --git a/th01/sprites/pellet_c.h b/th01/sprites/pellet_c.h new file mode 100644 index 00000000..b4712f07 --- /dev/null +++ b/th01/sprites/pellet_c.h @@ -0,0 +1,5 @@ +#define PELLET_CLOUD_W 16 +#define PELLET_CLOUD_H 16 +#define PELLET_CLOUD_CELS 1 + +extern const dots16_t sPELLET_CLOUD[PELLET_CLOUD_CELS][PELLET_CLOUD_H]; diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 2a901f5b..4f59e744 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -4623,216 +4623,8 @@ main_08_TEXT ends ; Segment type: Pure code main_09_TEXT segment byte public 'CODE' use16 - assume cs:main_09_TEXT - ;org 0Eh - assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_1133E proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -@@col = word ptr 0Ah -arg_6 = word ptr 0Ch - - push bp - mov bp, sp - push si - push di - mov ax, [bp+arg_0] - sar ax, 3 - mov dx, [bp+arg_2] - shl dx, 6 - add ax, dx - mov dx, [bp+arg_2] - shl dx, 4 - add ax, dx - mov di, ax - call _grcg_setcolor_rmw stdcall, [bp+@@col] - pop cx - xor si, si - jmp short loc_11398 -; --------------------------------------------------------------------------- - -loc_11368: - mov bx, [bp+arg_6] - shl bx, 5 - mov ax, si - add ax, ax - add bx, ax - cmp word ptr [bx+0BFEh], 0 - jz short loc_11394 - mov bx, [bp+arg_6] - shl bx, 5 - mov ax, si - add ax, ax - add bx, ax - mov ax, [bx+0BFEh] - les bx, _VRAM_PLANE_B - add bx, di - mov es:[bx], ax - -loc_11394: - inc si - add di, 50h ; 'P' - -loc_11398: - cmp si, 10h - jl short loc_11368 - call _grcg_off_func - pop di - pop si - pop bp - retf -sub_1133E endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_113A6 proc far - -var_8 = word ptr -8 -var_6 = word ptr -6 -var_4 = word ptr -4 -var_2 = word ptr -2 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 8, 0 - push si - push di - mov ax, [bp+arg_0] - sar ax, 3 - mov dx, [bp+arg_2] - shl dx, 6 - add ax, dx - mov dx, [bp+arg_2] - shl dx, 4 - add ax, dx - mov si, ax - push [bp+arg_4] - push 0 - push [bp+arg_2] - push [bp+arg_0] - call sub_1133E - add sp, 8 - xor di, di - jmp loc_114BE -; --------------------------------------------------------------------------- - -loc_113DB: - mov bx, [bp+arg_4] - shl bx, 5 - mov ax, di - add ax, ax - add bx, ax - cmp word ptr [bx+0BFEh], 0 - jnz short loc_113F1 - jmp loc_114BA -; --------------------------------------------------------------------------- - -loc_113F1: - push 1 - call _graph_accesspage_func - mov bx, [bp+arg_4] - shl bx, 5 - mov ax, di - add ax, ax - add bx, ax - mov ax, [bx+0BFEh] - les bx, _VRAM_PLANE_B - add bx, si - and ax, es:[bx] - mov [bp+var_8], ax - mov bx, [bp+arg_4] - shl bx, 5 - mov ax, di - add ax, ax - add bx, ax - mov ax, [bx+0BFEh] - les bx, _VRAM_PLANE_R - add bx, si - and ax, es:[bx] - mov [bp+var_6], ax - mov bx, [bp+arg_4] - shl bx, 5 - mov ax, di - add ax, ax - add bx, ax - mov ax, [bx+0BFEh] - les bx, _VRAM_PLANE_G - add bx, si - and ax, es:[bx] - mov [bp+var_4], ax - mov bx, [bp+arg_4] - shl bx, 5 - mov ax, di - add ax, ax - add bx, ax - mov ax, [bx+0BFEh] - les bx, _VRAM_PLANE_E - add bx, si - and ax, es:[bx] - mov [bp+var_2], ax - push 0 - call _graph_accesspage_func - add sp, 4 - cmp [bp+var_8], 0 - jz short loc_11484 - les bx, _VRAM_PLANE_B - add bx, si - mov ax, [bp+var_8] - or es:[bx], ax - -loc_11484: - cmp [bp+var_6], 0 - jz short loc_11496 - les bx, _VRAM_PLANE_R - add bx, si - mov ax, [bp+var_6] - or es:[bx], ax - -loc_11496: - cmp [bp+var_4], 0 - jz short loc_114A8 - les bx, _VRAM_PLANE_G - add bx, si - mov ax, [bp+var_4] - or es:[bx], ax - -loc_114A8: - cmp [bp+var_2], 0 - jz short loc_114BA - les bx, _VRAM_PLANE_E - add bx, si - mov ax, [bp+var_2] - or es:[bx], ax - -loc_114BA: - inc di - add si, 50h ; 'P' - -loc_114BE: - cmp di, 10h - jge short loc_114C6 - -loc_114C3: - jmp loc_113DB -; --------------------------------------------------------------------------- - -loc_114C6: - pop di - pop si - leave - retf -sub_113A6 endp - + extern _pellet_cloud_put_8:proc + extern _pellet_cloud_unput_8:proc main_09_TEXT ends ; =========================================================================== @@ -56476,11 +56268,7 @@ loc_30F9A: mov bx, word_3B530 cmp word ptr [bx+20h], 5 jnz short loc_30FB6 - push 0 - push word ptr [bx+24h] - push word ptr [bx+22h] - call sub_113A6 - add sp, 6 + call _pellet_cloud_unput_8 c, word ptr [bx+22h], word ptr [bx+24h], 0 jmp short loc_30FFE ; --------------------------------------------------------------------------- @@ -56495,7 +56283,7 @@ loc_30FC2: mov bx, word_3B530 push word ptr [bx+24h] push word ptr [bx+22h] - call sub_1133E + call _pellet_cloud_put_8 add sp, 8 jmp short loc_30FFE ; --------------------------------------------------------------------------- @@ -56504,11 +56292,7 @@ loc_30FD8: mov bx, word_3B530 cmp word ptr [bx+20h], 9 jnz short loc_30FFE - push 1 - push word ptr [bx+24h] - push word ptr [bx+22h] - call sub_113A6 - add sp, 6 + call _pellet_cloud_unput_8 c, word ptr [bx+22h], word ptr [bx+24h], 1 mov bx, word_3B530 mov word ptr [bx+20h], 0 mov byte ptr [bx], 1 @@ -56823,70 +56607,7 @@ include libs/master.lib/clip[data].asm include libs/master.lib/sin8[data].asm include libs/master.lib/atan8[data].asm include libs/master.lib/rand[data].asm - db 7 - db 0E0h - db 18h - db 18h - db 30h ; 0 - db 0Ch - db 50h ; P - db 5 - db 40h - db 2 - db 80h - db 1 - db 80h - db 1 - db 81h - db 81h - db 81h - db 81h - db 80h - db 1 - db 80h - db 1 - db 40h - db 2 - db 50h ; P - db 5 - db 0C0h ; À - db 0Ch - db 18h - db 18h - db 7 - db 0E0h - db 1 - db 80h - db 8 - db 10h - db 10h - db 4 - db 40h - db 2 - db 0 - db 0 - db 84h - db 1 - db 0 - db 10h - db 0 - db 1 - db 80h - db 1 - db 88h - db 0 - db 80h - db 20h - db 0 - db 0 - db 40h - db 2 - db 0 - db 0 - db 18h - db 8 - db 3 - db 20h +include th01/sprites/pellet_c.asp public _res_id _res_id db 'ReiidenConfig',0 unk_355EC db 0