From 791c3fa594b0dfc3f1cea801a191ab12c80dca98 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 17 Feb 2017 09:04:16 -0600 Subject: [PATCH] enti->spri is now enti.spri --- {src => 16/othersrc}/emmtest.c | 0 {src => 16/othersrc}/emstest.c | 0 16/othersrc/test.c | 227 +++++++++++++++++++++++++++++++++ {src => 16/othersrc}/test0.c | 0 {src => 16/othersrc}/test2.c | 0 {src => 16/othersrc}/testsnd.c | 0 {src => 16/src}/lib/bitmap.c | 0 {src => 16/src}/lib/bitmap.h | 0 DEBUG.16W | 210 ++++++++++++++++++++++++++++++ HEAP.16W | 69 ++++++++++ MMDUMP.16W | Bin 0 -> 2550 bytes src/lib/16_enti.c | 6 +- src/lib/16_head.c | 4 +- src/lib/16_map.c | 2 +- src/lib/16_spri.c | 32 ++--- src/lib/16_tdef.h | 6 +- src/lib/16_vl.h | 1 - src/lib/16_vrs.c | 4 +- src/lib/scroll16.c | 8 +- src/lib/scroll16.h | 3 +- src/maptest.c | 2 +- src/vrstest.c | 22 ++-- src/zcroll.c | 5 +- 23 files changed, 552 insertions(+), 49 deletions(-) rename {src => 16/othersrc}/emmtest.c (100%) rename {src => 16/othersrc}/emstest.c (100%) create mode 100755 16/othersrc/test.c rename {src => 16/othersrc}/test0.c (100%) rename {src => 16/othersrc}/test2.c (100%) rename {src => 16/othersrc}/testsnd.c (100%) rename {src => 16/src}/lib/bitmap.c (100%) rename {src => 16/src}/lib/bitmap.h (100%) create mode 100755 DEBUG.16W create mode 100755 HEAP.16W create mode 100755 MMDUMP.16W diff --git a/src/emmtest.c b/16/othersrc/emmtest.c similarity index 100% rename from src/emmtest.c rename to 16/othersrc/emmtest.c diff --git a/src/emstest.c b/16/othersrc/emstest.c similarity index 100% rename from src/emstest.c rename to 16/othersrc/emstest.c diff --git a/16/othersrc/test.c b/16/othersrc/test.c new file mode 100755 index 00000000..2885dc46 --- /dev/null +++ b/16/othersrc/test.c @@ -0,0 +1,227 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include "src/lib/16_vl.h" +#include "src/lib/16_vlpal.h" +#include "src/lib/16_in.h" +#include "src/lib/scroll16.h" + +#define LGQ 32 +#define HGQ 55 + +static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ + +void main(int argc, char *argv[]) +{ + static word paloffset=0; + static global_game_variables_t gvar; + static player_t player[MaxPlayers]; + + map_t map; + map_view_t mv[4]; + + int i, j; + word startclk, endclk; + word k; + + imgtestpal_t bmp1, bmp2; + + + bmp1.width=bmp2.width= 40; + bmp1.width=bmp2.height= 30; + + //====word colo=LGQ; + + // DOSLIB: check our environment + /*probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + + if (_DEBUG_INIT() == 0) { +#ifdef DEBUGSERIAL + printf("WARNING: Failed to initialize DEBUG output\n"); +#endif + } + _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log + _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/ + Startup16(&gvar); + + /* save the palette */ + //====modexPalSave(pal); + //====modexFadeOff(1, pal); + //====modexPalBlack(); + + //IN_Startup(); + IN_Default(0,&player,ctrl_Keyboard1); + EN_initplayer(&player, 0, &gvar.video); + + VGAmodeX(1, 1, &gvar); + modexPalBlack(); + + /* load our palette */ + VL_LoadPalFile("data/16.pal", &gvar.video.palette); + bmp1.offset=(paloffset/3); + VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0, &gvar); + + //VL_LoadPalFilewithoffset("data/default.pal", &palette, paloffset); + modexLoadPalFile("data/16t.pal", &gvar.video.dpal); + bmp2.offset=(paloffset/3); + VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar); + //====modexLoadPalFile("data/default.pal", &pal2); + + /* overscan show */ + //modexPalOverscan(44+1); + + /* set up the page, but with 16 pixels on all borders in offscreen mem */ + modexHiganbanaPageSetup(&gvar.video); + ZC_MVSetup(&mv, &map, &gvar); + + /* fill the page with one color, but with a black border */ + /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15); + modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128); + modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42); + modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128); + modexShowPage(&gvar.video.page[1]); + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15); + modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128); + modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42); + modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128); + modexShowPage(&gvar.video.page[0]);*/ + + + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 1); + modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 2); + modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 3); + modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 2); + modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height); + modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 4); + modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 6); + + + /* fade in */ + //====modexFadeOn(1, pal2); + + i=0,k=0,j=0; + startclk = *clockw; + while(!IN_KeyDown(sc_Escape)) + { + IN_ReadControl(0,&player); + ZC_panPageManual(&mv, &player, 0); + //[gvar.video.sp] + //ZC_MVSync(&mv); + + /*if(i<5){ + switch (k) + { + case 0: + pee: + // go right + gvar.video.page[gvar.video.sp].dx++; + if(i==5){ if(j>=31){ i++; j=0; goto baka; }else j++; }else + if(j>=32){ k++; j=0; }else j++; + break; + case 1: + // go left + gvar.video.page[gvar.video.sp].dx--; + if(j>=32){ k++; j=0; }else j++; + break; + case 2: + // go up + gvar.video.page[gvar.video.sp].dy++; + if(j>=32){ k++; j=0; }else j++; + break; + case 3: + // go down + gvar.video.page[gvar.video.sp].dy--; + if(j>=32){ k=0; j=0; i++; }else j++; + break; + default: + + break; + }}else{ + if(i==5) goto pee; + baka: + i++; + modexClearRegion(&gvar.video.page[1], 0, gvar.video.page[0].height/2, gvar.video.page[0].width-32, 16, 45);*/ +// if(IN_KeyDown(6)) +// { +// modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45); +// } +// if(IN_KeyDown(4+1)){ +// modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128); +// modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42); +// modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128); +// } + //} + PANKEYFUN; + if(IN_KeyDown(12)) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15); + if(IN_KeyDown(13)) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15); +/*==== if(IN_KeyDown(7)){ + for(i=0;i<3;i++) + { + pal2[i] = rand()%64; + modexPalUpdate(pal2); + colo++; + if(colo>HGQ) colo=LGQ; + } +// if(i>PAL_SIZE) i=0; + }//9*/ + if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1,1); }//p + //VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0); + ZC_ShowMV(&mv, 0, 0); + } + + endclk = *clockw; + + /* fade back to text mode */ + //====modexFadeOff(1, pal2); + //====modexPalBlack(); + VGAmodeX(0, 1, &gvar); + Shutdown16(&gvar); + printf("Project 16 test.exe. This is just a test file!\n"); + printf("version %s\n", VERSION); + VL_PrintmodexmemInfo(&gvar.video); + printf("tx=%d ", mv[gvar.video.sp].tx); printf("ty=%d ", mv[gvar.video.sp].ty); printf("player.d=%d\n", player[0].enti.d); + printf("\n====\n"); + printf("0 paloffset= %d\n", paloffset/3); + printf("====\n\n"); + //IN_Shutdown(); + //====modexPalBlack(); + //====modexFadeOn(1, pal); +} diff --git a/src/test0.c b/16/othersrc/test0.c similarity index 100% rename from src/test0.c rename to 16/othersrc/test0.c diff --git a/src/test2.c b/16/othersrc/test2.c similarity index 100% rename from src/test2.c rename to 16/othersrc/test2.c diff --git a/src/testsnd.c b/16/othersrc/testsnd.c similarity index 100% rename from src/testsnd.c rename to 16/othersrc/testsnd.c diff --git a/src/lib/bitmap.c b/16/src/lib/bitmap.c similarity index 100% rename from src/lib/bitmap.c rename to 16/src/lib/bitmap.c diff --git a/src/lib/bitmap.h b/16/src/lib/bitmap.h similarity index 100% rename from src/lib/bitmap.h rename to 16/src/lib/bitmap.h diff --git a/DEBUG.16W b/DEBUG.16W new file mode 100755 index 00000000..311e948c --- /dev/null +++ b/DEBUG.16W @@ -0,0 +1,210 @@ +Seg:0 Size:9880 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0000 +Seg:276c Size:36 Owner:0x0 ++ +Seg:2790 Size:256 Owner:0x1c7c +++++ +Seg:2890 Size:256 Owner:0x1a6e +++++ +Seg:2990 Size:256 Owner:0x1a70 +++++ +Seg:2a90 Size:256 Owner:0x1a72 +++++ +Seg:2b90 Size:256 Owner:0x1a74 +++++ +Seg:2c90 Size:256 Owner:0x1a76 +++++ +Seg:2d90 Size:256 Owner:0x1a78 +++++ +Seg:2e90 Size:256 Owner:0x1a7a +++++ +Seg:2f90 Size:256 Owner:0x1a7c +++++ +Seg:3090 Size:256 Owner:0x1a7e +++++ +Seg:3190 Size:256 Owner:0x1a80 +++++ +Seg:3290 Size:256 Owner:0x1a82 +++++ +Seg:3390 Size:256 Owner:0x1a84 +++++ +Seg:3490 Size:256 Owner:0x1a86 +++++ +Seg:3590 Size:256 Owner:0x1a88 +++++ +Seg:3690 Size:256 Owner:0x1a8a +++++ +Seg:3790 Size:256 Owner:0x1a8c +++++ +Seg:3890 Size:256 Owner:0x1a8e +++++ +Seg:3990 Size:256 Owner:0x1a90 +++++ +Seg:3a90 Size:256 Owner:0x1a92 +++++ +Seg:3b90 Size:256 Owner:0x1a94 +++++ +Seg:3c90 Size:256 Owner:0x1a96 +++++ +Seg:3d90 Size:256 Owner:0x1a98 +++++ +Seg:3e90 Size:256 Owner:0x1a9a +++++ +Seg:3f90 Size:256 Owner:0x1a9c +++++ +Seg:4090 Size:256 Owner:0x1a9e +++++ +Seg:4190 Size:256 Owner:0x1aa0 +++++ +Seg:4290 Size:256 Owner:0x1aa2 +++++ +Seg:4390 Size:256 Owner:0x1aa4 +++++ +Seg:4490 Size:256 Owner:0x1aa6 +++++ +Seg:4590 Size:256 Owner:0x1aa8 +++++ +Seg:4690 Size:256 Owner:0x1aaa +++++ +Seg:4790 Size:256 Owner:0x1aac +++++ +Seg:4890 Size:256 Owner:0x1aae +++++ +Seg:4990 Size:256 Owner:0x1ab0 +++++ +Seg:4a90 Size:256 Owner:0x1ab2 +++++ +Seg:4b90 Size:256 Owner:0x1ab4 +++++ +Seg:4c90 Size:256 Owner:0x1ab6 +++++ +Seg:4d90 Size:256 Owner:0x1ab8 +++++ +Seg:4e90 Size:256 Owner:0x1aba +++++ +Seg:4f90 Size:256 Owner:0x1abc +++++ +Seg:5090 Size:256 Owner:0x1abe +++++ +Seg:5190 Size:256 Owner:0x1ac0 +++++ +Seg:5290 Size:256 Owner:0x1ac2 +++++ +Seg:5390 Size:256 Owner:0x1ac4 +++++ +Seg:5490 Size:256 Owner:0x1ac6 +++++ +Seg:5590 Size:256 Owner:0x1ac8 +++++ +Seg:5690 Size:256 Owner:0x1aca +++++ +Seg:5790 Size:256 Owner:0x1acc +++++ +Seg:5890 Size:256 Owner:0x1ace +++++ +Seg:5990 Size:256 Owner:0x1ad0 +++++ +Seg:5a90 Size:256 Owner:0x1ad2 +++++ +Seg:5b90 Size:256 Owner:0x1ad4 +++++ +Seg:5c90 Size:256 Owner:0x1ad6 +++++ +Seg:5d90 Size:256 Owner:0x1ad8 +++++ +Seg:5e90 Size:256 Owner:0x1ada +++++ +Seg:5f90 Size:256 Owner:0x1adc +++++ +Seg:6090 Size:256 Owner:0x1ade +++++ +Seg:6190 Size:256 Owner:0x1ae0 +++++ +Seg:6290 Size:256 Owner:0x1ae2 +++++ +Seg:6390 Size:256 Owner:0x1ae4 +++++ +Seg:6490 Size:256 Owner:0x1ae6 +++++ +Seg:6590 Size:256 Owner:0x1ae8 +++++ +Seg:6690 Size:256 Owner:0x1aea +++++ +Seg:6790 Size:256 Owner:0x1aec +++++ +Seg:6890 Size:256 Owner:0x1aee +++++ +Seg:6990 Size:256 Owner:0x1af0 +++++ +Seg:6a90 Size:256 Owner:0x1af2 +++++ +Seg:6b90 Size:256 Owner:0x1af4 +++++ +Seg:6c90 Size:256 Owner:0x1af6 +++++ +Seg:6d90 Size:256 Owner:0x1af8 +++++ +Seg:6e90 Size:256 Owner:0x1afa +++++ +Seg:6f90 Size:256 Owner:0x1afc +++++ +Seg:7090 Size:256 Owner:0x1afe +++++ +Seg:7190 Size:256 Owner:0x1b00 +++++ +Seg:7290 Size:256 Owner:0x1b02 +++++ +Seg:7390 Size:256 Owner:0x1b04 +++++ +Seg:7490 Size:256 Owner:0x1b06 +++++ +Seg:7590 Size:256 Owner:0x1b08 +++++ +Seg:7690 Size:256 Owner:0x1b0a +++++ +Seg:7790 Size:256 Owner:0x1b0c +++++ +Seg:7890 Size:256 Owner:0x1b0e +++++ +Seg:7990 Size:256 Owner:0x1b10 +++++ +Seg:7a90 Size:256 Owner:0x1b12 +++++ +Seg:7b90 Size:256 Owner:0x1b14 +++++ +Seg:7c90 Size:256 Owner:0x1b16 +++++ +Seg:7d90 Size:256 Owner:0x1b18 +++++ +Seg:7e90 Size:256 Owner:0x1b1a +++++ +Seg:7f90 Size:256 Owner:0x1b1c +++++ +Seg:8090 Size:256 Owner:0x1b1e +++++ +Seg:8190 Size:256 Owner:0x1b20 +++++ +Seg:8290 Size:256 Owner:0x1b22 +++++ +Seg:8390 Size:256 Owner:0x1b24 +++++ +Seg:8490 Size:256 Owner:0x1b26 +++++ +Seg:8590 Size:256 Owner:0x1b28 +++++ +Seg:8690 Size:256 Owner:0x1b2a +++++ +Seg:8790 Size:256 Owner:0x1b2c +++++ +Seg:8890 Size:256 Owner:0x1b2e +++++ +Seg:8990 Size:256 Owner:0x1b30 +++++ +Seg:8a90 Size:256 Owner:0x1b32 +++++ +Seg:8b90 Size:256 Owner:0x1b34 +++++ +Seg:8c90 Size:401 Owner:0x1a4c +++++++ +Seg:b790 Size:18543 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W new file mode 100755 index 00000000..8e94789a --- /dev/null +++ b/HEAP.16W @@ -0,0 +1,69 @@ + + == default == + + FREE block at 278e0016 of size 68 + USED block at 278e005a of size 50 + USED block at 278e008c of size 50 + USED block at 278e00be of size 50 + USED block at 278e00f0 of size 50 + USED block at 278e0122 of size 50 + USED block at 278e0154 of size 50 + USED block at 278e0186 of size 50 + USED block at 278e01b8 of size 50 + USED block at 278e01ea of size 50 + USED block at 278e021c of size 50 + USED block at 278e024e of size 50 + USED block at 278e0280 of size 50 + FREE block at 278e02b2 of size 14 + USED block at 278e02c0 of size 20 + USED block at 278e02d4 of size 136 + FREE block at 278e035c of size 7328 +OK - end of heap + + == near == + + USED block at 178deeb6 of size 12 + USED block at 178deec2 of size 330 + USED block at 178df00c of size 52 + USED block at 178df040 of size 20 + USED block at 178df054 of size 20 + USED block at 178df068 of size 20 + USED block at 178df07c of size 20 + USED block at 178df090 of size 20 + USED block at 178df0a4 of size 3928 +OK - end of heap + + == far == + + USED block at 278e0016 of size 68 + USED block at 278e005a of size 50 + USED block at 278e008c of size 50 + USED block at 278e00be of size 50 + USED block at 278e00f0 of size 50 + USED block at 278e0122 of size 50 + USED block at 278e0154 of size 50 + USED block at 278e0186 of size 50 + USED block at 278e01b8 of size 50 + USED block at 278e01ea of size 50 + USED block at 278e021c of size 50 + USED block at 278e024e of size 50 + USED block at 278e0280 of size 50 + USED block at 278e02b2 of size 14 + USED block at 278e02c0 of size 20 + USED block at 278e02d4 of size 136 + USED block at 278e035c of size 7328 +OK - end of heap + +Memory Type Total Used Free +---------------- -------- -------- -------- +Default 8166 756 7410 +Near 4422 494 3928 +Far 8166 756 7410 +---------------- -------- -------- -------- +coreleft = 3926 +farcoreleft = 35742 +GetFreeSize = 31836 +GetNearFreeSize = 3928 +GetFarFreeSize = 31836 +memavl = 3926 +stackavail = 31541 diff --git a/MMDUMP.16W b/MMDUMP.16W new file mode 100755 index 0000000000000000000000000000000000000000..1fa858260ca451d671feb35025688155f1815911 GIT binary patch literal 2550 zcmZ|Ry-kBL6oyf1BzE}9P(-qwD6x^)ffaoHGXra|F=>z}a_Xme@9A#(PN~d~+^^#} zoqyhs&*PR#dwWfP;kJ&`*UOV|PYOlhs&G@N3SHshcz&)NRgNl0m7~g0<*0I0IjS5@ zjwVNwqsh_aXmT_;njBq@E=QN6%hBcNa&$Sm93e-@5pskaAxFp&a)ca1jv>d8W5_Y& z7;+3bh8$ClDaVv!$}#1ba!fg<97~QR$C6{ovE*2CEIF1OTaGQqmSfAY<=Ap;IW`=T z;D`iABse0$5ebe+a72P5k{nr%EJv0j%aP^Ca%4HO97T>IN0Fn*QRFCc6gi3<7db9+ OT;Le@$N2f*5BCcb-3xvI literal 0 HcmV?d00001 diff --git a/src/lib/16_enti.c b/src/lib/16_enti.c index cc419796..6f5b49cd 100755 --- a/src/lib/16_enti.c +++ b/src/lib/16_enti.c @@ -69,13 +69,13 @@ void EN_initentity(entity_t *enti, video_t *video) void EN_initplayer(player_t *player, word pn, video_t *video) { EN_initentity(&player[pn].enti, video); - player[pn].enti.spri->x = player[0].enti.x-4; - player[pn].enti.spri->y = player[0].enti.y-16; + player[pn].enti.spri.x = player[0].enti.x-4; + player[pn].enti.spri.y = player[0].enti.y-16; player[pn].walktype=0; player[pn].enti.dire=30; vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew;//skewing bug - video->sprifilei = set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); + video->sprifilei = set_anim_by_id(&player[pn].enti.spri, player[pn].enti.dire); animate_spri(&player[pn].enti, video); //print_anim_ids(player[0].enti.spri); diff --git a/src/lib/16_head.c b/src/lib/16_head.c index 7f46743e..2dadb971 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -52,7 +52,7 @@ char *remove_ext (char* mystr, char dot, char sep) { if (mystr == NULL) return NULL; - if ((retstr = malloc (strlen (mystr) + 1)) == NULL) + if ((retstr = malloc(strlen (mystr) + 1)) == NULL) return NULL; // Make a copy and find the relevant characters. @@ -80,7 +80,7 @@ char *remove_ext (char* mystr, char dot, char sep) { } // Return the modified string. - + free(mystr); return retstr; } diff --git a/src/lib/16_map.c b/src/lib/16_map.c index 3b1d7d72..931afe43 100755 --- a/src/lib/16_map.c +++ b/src/lib/16_map.c @@ -88,7 +88,7 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { #ifdef DEBUG_MAPDATA printf("objects detected\n"); #endif -// map->layerdata[k].layername = malloc(sizeof(byte) * MAPLNAMESIZE);//TODO: USE MM_ CA_ AND PM_ +// map->layerdata[k].layername = mAlloc(sizeof(byte) * MAPLNAMESIZE);//TODO: USE MM_ CA_ AND PM_ // strncpy(map->layerdata[k].layername, js+t[i+1].start, MAPLNAMESIZE);//TODO: USE MM_ CA_ AND PM_ // if(map->layerdata[k].layername[MAPLNAMESIZE]!=0) map->layerdata[k].layername[MAPLNAMESIZE]='\0'; }else if(jsoneq(js, &(t[i]), "name") == 0) { diff --git a/src/lib/16_spri.c b/src/lib/16_spri.c index 5029636e..f4c79537 100755 --- a/src/lib/16_spri.c +++ b/src/lib/16_spri.c @@ -103,8 +103,8 @@ void animate_spri(entity_t *enti, video_t *video) int x,y,rx,ry,w,h; VGA_RAM_PTR omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr - x=enti->spri->x; - y=enti->spri->y; + x=enti->spri.x; + y=enti->spri.y; VL_Initofs(video); // Depending on delay, update indices @@ -119,7 +119,7 @@ void animate_spri(entity_t *enti, video_t *video) vga_wm1_mem_block_copy(copy_ofs, display_ofs, vga_state.vga_stride * vga_state.vga_height); vga_restore_rm0wm0();*/ - switch(enti->spri->delay) + switch(enti->spri.delay) { // Delay = 0 means that sprite should loop. Nothing to change here case 0: @@ -128,18 +128,18 @@ void animate_spri(entity_t *enti, video_t *video) // Delay = 1 means that on next time unit sprite should be changed case 1: INC_PER_FRAME - enti->spri->curr_anim_spri++; + enti->spri.curr_anim_spri++; // If we hit the end of an animation sequence, restart it - if(!( enti->spri->curr_spri_id = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].sprite_id)){ - enti->spri->curr_anim_spri = 0; - enti->spri->curr_spri_id = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].sprite_id; + if(!( enti->spri.curr_spri_id = enti->spri.curr_anim_list[enti->spri.curr_anim_spri].sprite_id)){ + enti->spri.curr_anim_spri = 0; + enti->spri.curr_spri_id = enti->spri.curr_anim_list[enti->spri.curr_anim_spri].sprite_id; } - enti->spri->delay = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].delay; + enti->spri.delay = enti->spri.curr_anim_list[enti->spri.curr_anim_spri].delay; // Delay > 1 means that we should not change sprite yet. Decrease delay default: - enti->spri->delay--; + enti->spri.delay--; break; } @@ -148,7 +148,7 @@ void animate_spri(entity_t *enti, video_t *video) // Draw sprite - j = get_vrl_by_id(enti->spri->spritesheet, enti->spri->curr_spri_id, enti->spri->sprite_vrl_cont); + j = get_vrl_by_id(enti->spri.spritesheet, enti->spri.curr_spri_id, enti->spri.sprite_vrl_cont); if(j < 0) { //Quit (gv, "Error retriving required sprite"); @@ -162,8 +162,8 @@ void animate_spri(entity_t *enti, video_t *video) else rx = -(video->page[0].dx); if (y >= enti->overdrawh) ry = (y - enti->overdrawh); else ry = -(video->page[0].dy); - h = enti->spri->sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry; - w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up + h = enti->spri.sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry; + w = (x + enti->spri.sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up if ((rx+w) > video->page[0].width) w = video->page[0].width-rx; if ((ry+h) > video->page[0].height) h = video->page[0].height-ry; @@ -190,10 +190,10 @@ void animate_spri(entity_t *enti, video_t *video) draw_vrl1_vgax_modex( x-rx, y-ry, - enti->spri->sprite_vrl_cont->vrl_header, - enti->spri->sprite_vrl_cont->line_offsets, - enti->spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - enti->spri->sprite_vrl_cont->data_size + enti->spri.sprite_vrl_cont->vrl_header, + enti->spri.sprite_vrl_cont->line_offsets, + enti->spri.sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), + enti->spri.sprite_vrl_cont->data_size ); #endif if(!video->rss) diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 447bfbf6..ec92baaa 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -108,11 +108,11 @@ typedef struct { byte *data; //TODO: 16_mm and 16_ca must handle this } mapl_t; //map layer array type def -#define MAPLAYERS 3 +#define MAP_LAYERS 3 typedef struct { //long planestart[3]; //unsigned planelength[3]; - mapl_t layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) + mapl_t layerdata[MAP_LAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this // tilesets for layers (currently ony 4 can be loaded wwww) int width, height; //this has to be signed! byte name[16]; @@ -168,7 +168,7 @@ typedef struct word speed; //entity speed! word spt; //speed per tile #ifdef __WATCOMC__ - sprite_t *spri; // sprite used by entity + sprite_t spri; // sprite used by entity #endif sword hp; //hitpoints of the entity nibble overdraww, overdrawh; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index d113825e..b1b03a21 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -26,7 +26,6 @@ #define MODEX16_H #include "src/lib/16_head.h" -#include "src/lib/bitmap.h" //#include "src/lib/planar.h" //#include "src/lib/modex16/16planar.h" #include "src/lib/16text.h" diff --git a/src/lib/16_vrs.c b/src/lib/16_vrs.c index 0b3fc8f5..f77c7e3c 100755 --- a/src/lib/16_vrs.c +++ b/src/lib/16_vrs.c @@ -74,8 +74,8 @@ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_varia } vrs.vrl_line_offsets = vrl_line_offsets; - enti->spri->spritesheet = &vrs; - enti->spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container)); + enti->spri.spritesheet = &vrs; + enti->spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container)); } // Read .vrs file into far memory diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index fdd675a1..b4523474 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -693,7 +693,7 @@ void shinku(global_game_variables_t *gv) // NTS: For some bizarre reason, gv->pee is not initialized, but the pointer is not NULL even // though it should be. Instead it's NULL as a neAr pointer but contains a non-null // segment value, so testing against NULL doesn't work. It is initialized properly if - // you call start_timer() though which uses neAr malloc. Rather than fight with that, + // you call start_timer() though which uses neAr mAlloc. Rather than fight with that, // I decided it would be better to declare a temp buffer statically and sprintf to that. // // This fixes *** Null pointer assignment detected error message in ZCROLL.EXE on exit. @@ -794,13 +794,13 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn) } player[pn].enti.dire+=dd; //setting xy position - player[pn].enti.spri->x = x; - player[pn].enti.spri->y = y; + player[pn].enti.spri.x = x; + player[pn].enti.spri.y = y; if((player[pn].enti.q==1 && player[pn].enti.pred != player[pn].enti.d) || !dd)//when dir changed OR when player change face direction { //0000printf(" q=%u pred=%u d=%u dd=%u\n", player[pn].enti.q, player[pn].enti.pred, player[pn].enti.d, dd); - set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); //pip->video->sprifilei = set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); if(pip->video->sprifilei == -1){ printf("ERROR! %u\n", player[pn].enti.dire); return; } + set_anim_by_id(&player[pn].enti.spri, player[pn].enti.dire); //pip->video->sprifilei = set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); if(pip->video->sprifilei == -1){ printf("ERROR! %u\n", player[pn].enti.dire); return; } player[pn].enti.pred = player[pn].enti.d; if(!dd)//changed direction while NOT moving! { diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index a749d7f9..cb92ce4a 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -28,7 +28,6 @@ #include "src/lib/bakapee.h" #include "src/lib/16_vl.h" #include "src/lib/16_in.h" -#include "src/lib/bitmap.h" #include "src/lib/16_map.h" //map is loaded here www #include "src/lib/16render.h" //#include "src/lib/16_map.h" //new map stuff @@ -83,7 +82,7 @@ printf("player vars:\n");\ printf(" xy: %dx%d", player[0].enti.x, player[0].enti.y); printf(" txy: %dx%d", player[0].enti.tx, player[0].enti.ty); printf(" triggxy: %dx%d", player[0].enti.triggerx, player[0].enti.triggery); printf(" value: %d\n", mv[1].map->layerdata[0].data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))]);\ printf(" hp: %d", (player[0].enti.hp)); printf(" q: %u", player[0].enti.q); printf(" info.dir: %u", player[0].info.dir); printf(" d: %u", player[0].enti.d); printf(" dire: %u", player[0].enti.dire);\ - printf(" pdir: %u\n", player[0].pdir); printf(" delay=%u", player[0].enti.spri->delay);\ + printf(" pdir: %u\n", player[0].pdir); printf(" delay=%u", player[0].enti.spri.delay);\ printf("\n\n");\ VL_PrintmodexmemInfo(&gvar.video);\ \ diff --git a/src/maptest.c b/src/maptest.c index e1cf3691..a605a8ef 100755 --- a/src/maptest.c +++ b/src/maptest.c @@ -61,7 +61,7 @@ main(int argc, char *argv[]) getch(); #ifdef DUMP_MAP //if(map.width*map.height != 1200) - for(k=0;kspritesheet = &vrs; - enti.spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container));*/ + enti.spri.spritesheet = &vrs; + enti.spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container));*/ VRS_LoadVRS("data/spri/chikyuu.vrs", &enti, &gvar); - i = set_anim_by_id((enti.spri), 31); + i = set_anim_by_id(&(enti.spri), 31); if (i == -1) { //Quit(&gvar, "ERROR!! glitch IN FILE!\n"); } - enti.spri->x = TILEWH-4; - enti.spri->y = TILEWH; + enti.spri.x = TILEWH-4; + enti.spri.y = TILEWH; // Uncomment to see broken sprites /* sega = mm.bufferseg; @@ -124,11 +124,11 @@ void main() //modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 2); VL_LoadPalFile("data/spri/chikyuu.pal", &gvar.video.palette); for (i = 0; i < 10; i++){ - enti.spri->delay = 1; + enti.spri.delay = 1; - if(i==5) set_anim_by_id(enti.spri, 21); + if(i==5) set_anim_by_id(&enti.spri, 21); - animate_spri(&enti, &gvar.video);// enti.spri->x += 16; + animate_spri(&enti, &gvar.video);// enti.spri.x += 16; delay(500); } @@ -154,10 +154,10 @@ void main() MM_DumpData(&gvar); MM_Report_(&gvar); Shutdown16(&gvar); - free(enti.spri->sprite_vrl_cont); - free(enti.spri->spritesheet->vrl_line_offsets); + free(enti.spri.sprite_vrl_cont); + free(enti.spri.spritesheet->vrl_line_offsets); MM_FreePtr(&bigbuffer, &gvar); - //MM_FreePtr(&((void __based(sega)*)enti.spri->spritesheet->buffer), &mm); + //MM_FreePtr(&((void __based(sega)*)enti.spri.spritesheet->buffer), &mm); //printf("CPU to VGA: %f\n", t1); //printf("VGA to VGA: %f\n", t2); heapdump(&gvar); diff --git a/src/zcroll.c b/src/zcroll.c index 6d38a789..af771fb7 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -74,9 +74,8 @@ void main(int argc, char *argv[]) // OK, this one takes hellova time and needs to be done in farmalloc or MM_... //IN CA i think you use CAL_SetupGrFile but i do think we should work together on this part --sparky4 - //player[0].ent = malloc(sizeof(entity_t)); - player[0].enti.spri = malloc(sizeof(struct sprite)); - player[0].enti.spri->spritesheet = malloc(sizeof(struct vrs_container)); + //player[0].enti.spri = malloc(sizeof(struct sprite)); + player[0].enti.spri.spritesheet = malloc(sizeof(struct vrs_container)); // create the map // fprintf(stderr, "testing map load~ "); -- 2.39.2