From: Jonathan Campbell Date: Sun, 17 Apr 2016 07:00:37 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=7cbfb3d1f53e33107205d1d8a5ed215898246504;hp=8d77030556e776f864e8e95bcbb5684ce2916d44;p=16.git Merge remote-tracking branch 'upstream/master' --- diff --git a/makefile b/makefile index d29eb7c4..57a260fb 100755 --- a/makefile +++ b/makefile @@ -82,7 +82,7 @@ DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) $(DOSLIBLIBS) -DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib +DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe # tsthimem.exe @@ -132,8 +132,8 @@ fonttest.exe: fonttest.$(OBJ) $(16LIBOBJS) gfx.lib #fonttes0.exe: fonttes0.$(OBJ) $(16LIBOBJS) # wcl $(FLAGS) fonttes0.$(OBJ) $(16LIBOBJS) -fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib - wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fontgfx.map +fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) + wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) -fm=fontgfx.map inputest.exe: inputest.$(OBJ) $(16LIBOBJS) wcl $(FLAGS) inputest.$(OBJ) $(16LIBOBJS) -fm=inputest.map @@ -293,8 +293,11 @@ $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu && .$(DIRSEP)make.sh $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos && .$(DIRSEP)make.sh +$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib: + cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh + joytest.exe: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)joystick && .$(DIRSEP)make.sh && $(COPYCOMMAND) dos86h$(DIRSEP)test.exe $(PDIR)$(PDIR)$(PDIR)$(PDIR)$(PDIR)joytest.exe #$(DOSLIBLIBS): .symbolic @@ -460,7 +463,7 @@ comq: .symbolic www: .symbolic @ssh -p 26 sparky4@4ch.mooo.com 'rm -f /var/www/16/*exe.zip*' - @rm "/var/www/$(EXEC).zip*" + @rm -f /var/www/*.exe.zip* #@cp ./$(EXEC) $(DIRSEP)var$(DIRSEP)www$(DIRSEP) @./z.sh $(EXEC) $(EXEC) @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/ diff --git a/pcx2vrl b/pcx2vrl index bd947e55..06179c75 100755 Binary files a/pcx2vrl and b/pcx2vrl differ diff --git a/pcxsscut b/pcxsscut index 1deec74d..2ce56d28 100755 Binary files a/pcxsscut and b/pcxsscut differ diff --git a/src/16.c b/src/16.c index bfe777e2..27c17a58 100755 --- a/src/16.c +++ b/src/16.c @@ -32,6 +32,27 @@ player_t player[MaxPlayers]; void main(int argc, char *argv[]) { + // 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; + } + //screen = modexDefaultPage(); engi_stat = ENGI_RUN; //textInit(); diff --git a/src/bakapi.c b/src/bakapi.c index 6d04e547..33388702 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -200,6 +200,7 @@ main(int argc, char *argvar[]) VGAmodeX(0, 0, &gvar); // user imput switch //fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile); + fprintf(stderr, "dx=%d dy=%d ", gvar.video.page[0].dx, gvar.video.page[0].dy); printf("Tiled mode is "); switch (bakapee.tile) { @@ -302,8 +303,8 @@ pee: // xpos+=xdir; // ypos+=ydir; -// if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} -// if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} +// if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} +// if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // ch=getch(); if(ch==0x71)break; // 'q' if(ch==0x1b)break; // 'ESC' diff --git a/src/drawvrl5.c b/src/drawvrl5.c deleted file mode 100755 index 3e01c145..00000000 --- a/src/drawvrl5.c +++ /dev/null @@ -1,354 +0,0 @@ - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static unsigned char palette[768]; - -int main(int argc,char **argv) { - struct vrl1_vgax_header *vrl_header; - vrl1_vgax_offset_t *vrl_lineoffs; - unsigned char *buffer; - unsigned int bufsz; - int fd; - - if (argc < 3) { - fprintf(stderr,"drawvrl \n"); - return 1; - } - - fd = open(argv[1],O_RDONLY|O_BINARY); - if (fd < 0) { - fprintf(stderr,"Unable to open '%s'\n",argv[1]); - return 1; - } - { - unsigned long sz = lseek(fd,0,SEEK_END); - if (sz < sizeof(*vrl_header)) return 1; - if (sz >= 65535UL) return 1; - - bufsz = (unsigned int)sz; - buffer = malloc(bufsz); - if (buffer == NULL) return 1; - - lseek(fd,0,SEEK_SET); - if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1; - - vrl_header = (struct vrl1_vgax_header*)buffer; - if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1; - if (vrl_header->width == 0 || vrl_header->height == 0) return 1; - } - close(fd); - - probe_dos(); - if (!probe_vga()) { - printf("VGA probe failed\n"); - return 1; - } - int10_setmode(19); - update_state_from_vga(); - vga_enable_256color_modex(); // VGA mode X - vga_state.vga_width = 320; // VGA lib currently does not update this - vga_state.vga_height = 200; // VGA lib currently does not update this - -#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case - { - struct vga_mode_params cm; - - vga_read_crtc_mode(&cm); - - // 320x240 mode 60Hz - cm.vertical_total = 525; - cm.vertical_start_retrace = 0x1EA; - cm.vertical_end_retrace = 0x1EC; - cm.vertical_display_end = 480; - cm.vertical_blank_start = 489; - cm.vertical_blank_end = 517; - - vga_write_crtc_mode(&cm,0); - } - vga_state.vga_height = 240; // VGA lib currently does not update this -#endif - - /* load color palette */ - fd = open(argv[2],O_RDONLY|O_BINARY); - if (fd >= 0) { - unsigned int i; - - read(fd,palette,768); - close(fd); - - vga_palette_lseek(0); - for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); - } - - /* preprocess the sprite to generate line offsets */ - vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - if (vrl_lineoffs == NULL) return 1; - - { - unsigned int i,j,o; - - /* fill screen with a distinctive pattern */ - for (i=0;i < vga_state.vga_width;i++) { - o = i >> 2; - vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); - for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride) - vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! - } - } - while (getch() != 13); - - /* make distinctive pattern offscreen, render sprite, copy onscreen */ - { - const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height); - unsigned int i,j,o,o2,x,y,rx,ry,w,h; - unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. - // if the sprite's edge pixels are clear anyway, you can set this to 0. - VGA_RAM_PTR omemptr; - int xdir=1,ydir=1; - - /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */ - x = 0; - y = 0; - - /* do it */ - omemptr = vga_state.vga_graphics_ram; // save original mem ptr - while (1) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; - } - - /* render box bounds. y does not need modification, but x and width must be multiple of 4 */ - if (x >= overdraw) rx = (x - overdraw) & (~3); - else rx = 0; - if (y >= overdraw) ry = (y - overdraw); - else ry = 0; - h = vrl_header->height + overdraw + y - ry; - w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3); - if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx; - if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry; - - /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */ - vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2; - vga_state.vga_draw_stride = w >> 2; - vga_state.vga_graphics_ram = omemptr + offscreen_ofs; - - /* first draw pattern corresponding to that part of the screen. this COULD be optimized, obviously, but it's designed for study. - * also note we don't have to use the same stride as the display! */ - for (i=rx;i < (rx+w);i++) { - o = (i-rx) >> 2; - vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); - for (j=ry;j < (ry+h);j++,o += vga_state.vga_draw_stride) - vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! - } - - /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ - draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - - /* restore ptr */ - vga_state.vga_graphics_ram = omemptr; - - /* block copy to visible RAM from offscreen */ - vga_setup_wm1_block_copy(); - o = offscreen_ofs; // source offscreen - o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride) - for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); - /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ - vga_restore_rm0wm0(); - - /* restore stride */ - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride; - - /* step */ - x += xdir; - y += ydir; - if (x >= (vga_state.vga_width - 1) || x == 0) - xdir = -xdir; - if (y >= (vga_state.vga_height - 1) || y == 0) - ydir = -ydir; - } - } - - /* make distinctive pattern offscreen, render sprite, copy onscreen. - * this time, we render the distinctive pattern to another offscreen location and just copy. - * note this version is much faster too! */ - { - const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height); - const unsigned int pattern_ofs = 0x10000UL - (vga_state.vga_stride * vga_state.vga_height); - unsigned int i,j,o,o2,x,y,rx,ry,w,h; - unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. - // if the sprite's edge pixels are clear anyway, you can set this to 0. - VGA_RAM_PTR omemptr; - int xdir=1,ydir=1; - - /* fill pattern offset with a distinctive pattern */ - for (i=0;i < vga_state.vga_width;i++) { - o = (i >> 2) + pattern_ofs; - vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); - for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride) - vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! - } - - /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */ - x = 0; - y = 0; - - /* do it */ - omemptr = vga_state.vga_graphics_ram; // save original mem ptr - while (1) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; - } - - /* render box bounds. y does not need modification, but x and width must be multiple of 4 */ - if (x >= overdraw) rx = (x - overdraw) & (~3); - else rx = 0; - if (y >= overdraw) ry = (y - overdraw); - else ry = 0; - h = vrl_header->height + overdraw + y - ry; - w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3); - if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx; - if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry; - - /* block copy pattern to where we will draw the sprite */ - vga_setup_wm1_block_copy(); - o2 = offscreen_ofs; - o = pattern_ofs + (ry * vga_state.vga_stride) + (rx >> 2); // source offscreen - for (i=0;i < h;i++,o += vga_state.vga_stride,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2); - /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ - vga_restore_rm0wm0(); - - /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */ - vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2; - vga_state.vga_draw_stride = w >> 2; - vga_state.vga_graphics_ram = omemptr + offscreen_ofs; - - /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ - draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - - /* restore ptr */ - vga_state.vga_graphics_ram = omemptr; - - /* block copy to visible RAM from offscreen */ - vga_setup_wm1_block_copy(); - o = offscreen_ofs; // source offscreen - o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride) - for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); - /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ - vga_restore_rm0wm0(); - - /* restore stride */ - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride; - - /* step */ - x += xdir; - y += ydir; - if (x >= (vga_state.vga_width - 1) || x == 0) - xdir = -xdir; - if (y >= (vga_state.vga_height - 1) || y == 0) - ydir = -ydir; - } - } - - /* another handy "demo" effect using VGA write mode 1. - * we can take what's on screen and vertically squash it like an old analog TV set turning off. */ - { - unsigned int blank_line_ofs = (vga_state.vga_stride * vga_state.vga_height * 2); - unsigned int copy_ofs = (vga_state.vga_stride * vga_state.vga_height); - unsigned int display_ofs = 0x0000; - unsigned int i,y,soh,doh,dstart; - unsigned int dh_blankfill = 8; - unsigned int dh_step = 8; - uint32_t sh,dh,yf,ystep; - - /* copy active display (0) to offscreen buffer (0x4000) */ - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride; - vga_setup_wm1_block_copy(); - vga_wm1_mem_block_copy(copy_ofs,display_ofs,vga_state.vga_stride * vga_state.vga_height); - vga_restore_rm0wm0(); - - /* need a blank line as well */ - for (i=0;i < vga_state.vga_stride;i++) vga_state.vga_graphics_ram[i+blank_line_ofs] = 0; - - sh = dh = vga_state.vga_height; - while (dh >= dh_step) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; - } - - /* wait for vsync end */ - vga_wait_for_vsync_end(); - - /* what scalefactor to use for stretching? */ - ystep = (0x10000UL * sh) / dh; - dstart = (vga_state.vga_height - dh) / 2; // center the squash effect on screen, otherwise it would squash to top of screen - doh = display_ofs; - soh = copy_ofs; - yf = 0; - y = 0; - - /* for performance, keep VGA in write mode 1 the entire render */ - vga_setup_wm1_block_copy(); - - /* blank lines */ - if (dstart >= dh_blankfill) y = dstart - dh_blankfill; - else y = 0; - doh = vga_state.vga_stride * y; - - while (y < dstart) { - vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride); - doh += vga_state.vga_stride; - y++; - } - - /* draw */ - while (y < (dh+dstart)) { - soh = copy_ofs + ((yf >> 16UL) * vga_state.vga_stride); - vga_wm1_mem_block_copy(doh,soh,vga_state.vga_stride); - doh += vga_state.vga_stride; - yf += ystep; - y++; - } - - /* blank lines */ - while (y < vga_state.vga_height && y < (dh+dstart+dh_blankfill)) { - vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride); - doh += vga_state.vga_stride; - y++; - } - - /* done */ - vga_restore_rm0wm0(); - - /* wait for vsync */ - vga_wait_for_vsync(); - - /* make it shrink */ - dh -= dh_step; - if (dh < 40) dh_step = 1; - } - } - - int10_setmode(3); - free(vrl_lineoffs); - buffer = NULL; - free(buffer); - bufsz = 0; - return 0; -} - diff --git a/src/fontgfx.c b/src/fontgfx.c index 2abb13ff..50427a3a 100755 --- a/src/fontgfx.c +++ b/src/fontgfx.c @@ -25,14 +25,20 @@ //#include "lib/16text.h" #include "lib/modex16.h" +#include +#include +#include +#include + global_game_variables_t gvar; void main(int argc, char near *argv[]) { + struct vga_mode_params cm; //JMOJI static byte e; //word ri; - byte pee[2]; + byte pee[6]; // must be large enough for sprintf("%zc",...) and sprintf("%u",(byte value)) static byte ibmlogo[]="IIIIIII BBBBBBBBB MMMMM MMMMM\n\ IIIIIII BBBBBBBBBBB MMMMMM MMMMMM\n\ III BBB BBB MMMMMM MMMMMM\n\ @@ -61,19 +67,46 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ ,'___...---~~~\n\ "; // static byte *rosa; - static word chx, chy, colpee; + static word chx, chy, colpee, addr; textInit(); + + // 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; + } VGAmodeX(1, 1, &gvar); /* setup camera and screen~ */ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); - //gvar.video.page[0].width += (16*2); - //gvar.video.page[0].height += (16*2); -//++++ modexShowPage(&gvar.video.page[0]); + gvar.video.page[0].width += (16*2); + gvar.video.page[0].height += (16*2); + modexShowPage(&gvar.video.page[0]); + vga_read_crtc_mode(&cm); + // NTS: We're in Mode-X now. printf() is useless. Do not use printf(). Or INT 10h text printing. Or DOS console output. //modexprint(16, 16, 1, 15, "wwww"); //getch(); chx=0; chy=0; colpee=32; +// bios_cls(); + /* position the cursor to home */ +// vga_moveto(0,0); +// vga_sync_bios_cursor(); for(e=0x00; e<=0xFE; e++) { if(chx+8>(gvar.video.page[0].width/2)) @@ -81,25 +114,28 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ chx=0; chy+=8; sprintf(pee,"%u", colpee); - modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 1); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee); //getch(); } - modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 1); + sprintf(pee, "%zc", e); + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e); chx+=9; colpee++; if(colpee>=32+24) colpee=32; } - //modexprint(100, 100, 1, 47, 0, "wwww"); getch(); + //modexprint(100, 100, 1, 47, 0, "wwww"); // modexprint(0, 0, 1, 0, colpee, &rose); //++++ modexprint(&gvar.video.page[0], 0, 0, 0, 0, colpee, &ibmlogo); // modexprintbig(&gvar.video.page[0], 0, 0, 1, colpee, 0, "IBM"); // modexprint(0, 0, 1, 0, colpee, ROSE); - getch(); +//++++ getch(); VGAmodeX(0, 1, &gvar); // rosa=malloc(sizeof(ROSE)); // (*rosa)=(byte)ROSE; printf("\n%s\n", rose); //printf("\nh=%d\n", '8'); // printf("\n%c\n", e); + printf("cm.offset=%d\n", cm.offset); + printf("vga_state.vga_stride=%d\n", vga_state.vga_stride); } diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 3217ea2e..4b9972f1 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -50,6 +50,7 @@ #include "src/lib/nyan/kitten.h" #include "src/lib/types.h" #include "src/lib/typdefst.h" +#include "src/lib/16_in.h" #define VERSION __DATE__ " " __TIME__ diff --git a/src/lib/16_in.c b/src/lib/16_in.c index aef50c68..5bccecaf 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -1282,3 +1282,19 @@ boolean IN_qb(byte kee) if(inpu.Keyboard[kee]==true) return 1; else return 0; } + +//init player! +void IN_initplayer(player_t *player, word pn) +{ + player[pn].x = player[pn].tx*TILEWH; + player[pn].y = player[pn].ty*TILEWH; + player[pn].triggerx = player[pn].tx; + player[pn].triggery = player[pn].ty+1; +/* player[0].info.x = player[0].tx; + player[0].info.xaxis = player[0].tx*TILEWH; + player[0].info.y = player[0].ty; + player[0].info.yaxis = player[0].ty*TILEWH;*/ + player[pn].q=1; + player[pn].d=2; + player[pn].hp=4; +} diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 0990a550..78ebd805 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -303,5 +303,6 @@ extern boolean IN_UserInput(dword delay,boolean clear); extern boolean IN_KeyDown(byte code); extern void IN_ClearKey(byte code); extern boolean IN_qb(byte kee); +void IN_initplayer(player_t *player, word pn); #endif diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c index 1626fd1d..b50c16e1 100755 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -34,7 +34,7 @@ void colortest(page_t *page, bakapee_t *pee) { //if(pee->coor < 256) //{ - cls(page, pee->coor, VGA); + modexcls(page, pee->coor, VGA); pee->coor++; //}else pee->coor = 0; } @@ -44,7 +44,7 @@ void colorz(page_t *page, bakapee_t *pee) { if(pee->coor <= HGQ) { - cls(page, pee->coor, VGA); + modexcls(page, pee->coor, VGA); pee->coor++; }else pee->coor = LGQ; } @@ -228,7 +228,7 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 6: pee->coor = rand()%256; - cls(page, pee->coor, VGA); + modexcls(page, pee->coor, VGA); break; case 7: if(pee->coor <= HGQ) @@ -239,7 +239,7 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 8: colorz(page, pee); - modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1); + modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi"); break; case 9: if(pee->coor <= HGQ) diff --git a/src/lib/bakapee.h b/src/lib/bakapee.h index e06c0b8f..a6076daf 100755 --- a/src/lib/bakapee.h +++ b/src/lib/bakapee.h @@ -28,6 +28,7 @@ #include #include #include + //#include "src/lib/modex/modex.h" //#include "16/x/modex.h" diff --git a/src/lib/doslib b/src/lib/doslib index 05fc315e..9990f0ad 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 05fc315e3b435866873be945a61f672f62f9199d +Subproject commit 9990f0adb22b4fed2598c8733172d131d1a412f2 diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 42d4f6c8..cab13766 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -80,7 +80,6 @@ vgaGetMode() void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) { word i; - dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA; /* used for faster screen clearing */ struct vga_mode_params cm; int CRTParmCount; @@ -94,9 +93,12 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) case 1: //CRTParmCount = sizeof(ModeX_320x240regs) / sizeof(ModeX_320x240regs[0]); /* width and height */ - gv->video.page[0].sw=vga_state.vga_width = 320; // VGA lib currently does not update this - gv->video.page[0].sh=vga_state.vga_height = 240; // VGA lib currently does not update this + gv->video.page[0].sw = vga_state.vga_width = 320; // VGA lib currently does not update this + gv->video.page[0].sh = vga_state.vga_height = 240; // VGA lib currently does not update this + // mode X BYTE mode + cm.word_mode = 0; + cm.dword_mode = 0; // 320x240 mode 60Hz cm.horizontal_total=0x5f + 5; /* CRTC[0] -5 */ cm.horizontal_display_end=0x4f + 1; /* CRTC[1] -1 */ @@ -115,6 +117,7 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) cm.clock_select = 0; /* misc register = 0xE3 25MHz */ cm.vsync_neg = 1; cm.hsync_neg = 1; + cm.offset = (vga_state.vga_width / (4 * 2)); // 320 wide (40 x 4 pixel groups x 2) break; case 2: // TODO: 160x120 according to ModeX_160x120regs return; @@ -128,15 +131,18 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) return; } + vga_state.vga_stride = cm.offset * 2; vga_write_crtc_mode(&cm,0); /* clear video memory */ switch (cmem) { - case 1: - /* clear video memory */ - vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/); - for(i=0; i<0x8000; i++) ptr[i] = 0x0000; + case 1: { + /* clear video memory */ + dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA; /* used for faster screen clearing */ + vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/); + for(i = 0;i < 0x4000; i++) ptr[i] = 0x0000; // 0x4000 x dword = 64KB + } break; } gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH; @@ -545,7 +551,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) static word a[PAL_SIZE]; //palette array of change values! word z=0, aq=0, aa=0, pp=0; - modexWaitBorder(); + //modexWaitBorder(); + vga_wait_for_vsync(); if((*i)==0) { memset(a, -1, sizeof(a)); @@ -595,7 +602,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) //if(qp>0) printf("qp=%d\n", qp); //if(qp>0) printf(" (*i)=%d\n", (*i)/3); } - modexWaitBorder(); /* waits one retrace -- less flicker */ + //modexWaitBorder(); /* waits one retrace -- less flicker */ + vga_wait_for_vsync(); if((*i)>=PAL_SIZE/2 && w==0) { for(; (*i)=page[0].sw-1){ x=0; yy+=4; } - modexClearRegion(page, x+xl, y+yy, 4, 4, color); - } - //modexputPixel(page, x+xl, y, color); -} - -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q) +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) { word s, o, w; word addr = (word) romFontsData.l; + word addrq = (page->width/4) * y + (x / 4) + ((word)page->data); byte c; s=romFonts[t].seg; @@ -917,7 +918,8 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons JNZ L1 } //TODO: OPTIMIZE THIS!!!! - modexDrawCharPBuf(page, x, y, t, col, bgcol, q); + modexDrawCharPBuf(page, x/*for mode X planar use*/, y/*redunant, remove*/, t, col, bgcol, addrq); + addrq += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */ //if(!q) getch(); } @@ -999,7 +1001,7 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c } /* palette dump on display! */ -void pdump(page_t *pee) +void modexpdump(page_t *pee) { int mult=(QUADWH); int palq=(mult)*TILEWH; @@ -1019,7 +1021,7 @@ void pdump(page_t *pee) // the Virtual screen. // // // ///////////////////////////////////////////////////////////////////////////// -void cls(page_t *page, byte color, byte *Where) +void modexcls(page_t *page, byte color, byte *Where) { //modexClearRegion(page, 0, 0, page->width, page->height, color); /* set map mask to all 4 planes */ @@ -1028,13 +1030,40 @@ void cls(page_t *page, byte color, byte *Where) _fmemset(Where, color, page->width*(page->height)/4); } -void +/*void modexWaitBorder() { while(inp(INPUT_STATUS_1) & 8) { - /* spin */ + // spin } while(!(inp(INPUT_STATUS_1) & 8)) { - /* spin */ + // spin } +}*/ + +void bios_cls() { + VGA_ALPHA_PTR ap; + VGA_RAM_PTR rp; + unsigned char m; + + m = int10_getmode(); + if ((rp=vga_state.vga_graphics_ram) != NULL && !(m <= 3 || m == 7)) { + unsigned int i,im; + + im = (FP_SEG(vga_state.vga_graphics_ram_fence) - FP_SEG(vga_state.vga_graphics_ram)); + if (im > 0xFFE) im = 0xFFE; + im <<= 4; + for (i=0;i < im;i++) vga_state.vga_graphics_ram[i] = 0; + } + else if ((ap=vga_state.vga_alpha_ram) != NULL) { + unsigned int i,im; + + im = (FP_SEG(vga_state.vga_alpha_ram_fence) - FP_SEG(vga_state.vga_alpha_ram)); + if (im > 0x7FE) im = 0x7FE; + im <<= 4 - 1; /* because ptr is type uint16_t */ + for (i=0;i < im;i++) vga_state.vga_alpha_ram[i] = 0x0720; + } + else { + printf("WARNING: bios cls no ptr\n"); + } } diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 3621466f..f85eb055 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -71,7 +71,7 @@ static struct pcxHeader { /* -========================== Types & Macros ==========================- */ #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2)) -#define PLANE(x) (1<< (x&3)) +#define PLANE(x) (1 << ((x) & 3)) #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02) #define PALSIZE 768 @@ -82,6 +82,32 @@ typedef union byte blue; } rgb_t; +/* -======================= Constants & Vars ==========================- */ +extern byte far* VGA; /* The VGA Memory */ +#define SCREEN_SEG 0xa000 +#define VIDEO_INT 0x10 +#define SET_MODE 0x00 +#define VGA_256_COLOR_MODE 0x13 +#define TEXT_MODE 0x03 + +#define AC_INDEX 0x03c0 +#define SC_INDEX 0x03c4 +#define SC_DATA 0x03c5 +#define CRTC_INDEX 0x03d4 +#define CRTC_DATA 0x03d5 +#define GC_INDEX 0x03ce +#define MISC_OUTPUT 0x03c2 +#define HIGH_ADDRESS 0x0C +#define LOW_ADDRESS 0x0D +#define VRETRACE 0x08 +//#define INPUT_STATUS_1 0x03da defined in 16_head +#define DISPLAY_ENABLE 0x01 +#define MAP_MASK 0x02 +#define PAL_READ_REG 0x03C7 /* Color register, read address */ +#define PAL_WRITE_REG 0x03C8 /* Color register, write address */ +#define PAL_DATA_REG 0x03C9 /* Color register, data port */ +#define PAL_SIZE (256 * 3) + /* -============================ Functions =============================- */ /* mode switching, page, and plane functions */ void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv); @@ -120,39 +146,41 @@ void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset); void modexPalUpdate1(byte *p); void modexPalUpdate0(byte *p); void modexPalOverscan(byte *p, word col); -void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/); +void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/); void modexputPixel(page_t *page, int x, int y, byte color); byte modexgetPixel(page_t *page, int x, int y); -void modexhlin(page_t *page, word xl, word xh, word y, word color); -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q); -void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str); -void pdump(page_t *pee); -void cls(page_t *page, byte color, byte *Where); -void modexWaitBorder(); -/* -======================= Constants & Vars ==========================- */ -extern byte far* VGA; /* The VGA Memory */ -#define SCREEN_SEG 0xa000 -#define VIDEO_INT 0x10 -#define SET_MODE 0x00 -#define VGA_256_COLOR_MODE 0x13 -#define TEXT_MODE 0x03 +#if 0 // not needed anymore. maybe good for reference purposes though. +static inline void modexwritepixel(page_t *page, int x, int y, word addr, byte color) +{ + /* Each address accesses four neighboring pixels, so set + Write Plane Enable according to which pixel we want + to modify. The plane is determined by the two least + significant bits of the x-coordinate: */ + modexSelectPlane(PLANE(x)); + //outp(SC_INDEX, 0x02); + //outp(SC_DATA, 0x01 << (x & 3)); + + /* The offset of the pixel into the video segment is + offset = (width * y + x) / 4, and write the given + color to the plane we selected above. Heed the active + page start selection. */ + vga_state.vga_graphics_ram[addr] = color; +} +static inline byte modexreadPixel(page_t *page, int x, int y, word addr) +{ + /* Select the plane from which we must read the pixel color: */ + outpw(GC_INDEX, 0x04); + outpw(GC_INDEX+1, x & 3); + return vga_state.vga_graphics_ram[addr]; +} +#endif + +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str); +void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str); +void modexpdump(page_t *pee); +void modexcls(page_t *page, byte color, byte *Where); +//void modexWaitBorder(); +void bios_cls(); -#define AC_INDEX 0x03c0 -#define SC_INDEX 0x03c4 -#define SC_DATA 0x03c5 -#define CRTC_INDEX 0x03d4 -#define CRTC_DATA 0x03d5 -#define GC_INDEX 0x03ce -#define MISC_OUTPUT 0x03c2 -#define HIGH_ADDRESS 0x0C -#define LOW_ADDRESS 0x0D -#define VRETRACE 0x08 -//#define INPUT_STATUS_1 0x03da defined in 16_head -#define DISPLAY_ENABLE 0x01 -#define MAP_MASK 0x02 -#define PAL_READ_REG 0x03C7 /* Color register, read address */ -#define PAL_WRITE_REG 0x03C8 /* Color register, write address */ -#define PAL_DATA_REG 0x03C9 /* Color register, data port */ -#define PAL_SIZE (256 * 3) #endif diff --git a/src/lib/modex16/16render.c b/src/lib/modex16/16render.c index 0399a777..8e6fa436 100755 --- a/src/lib/modex16/16render.c +++ b/src/lib/modex16/16render.c @@ -435,34 +435,38 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, } } -void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q) +void modexDrawCharPBuf(page_t *page, int x/*for planar selection only*/, int y/*redundant, remove*/, word t, word col, word bgcol, word addr) { - word i, j, k; - for(i=0; idata + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)), romFontsData.l[i] & j ? col:bgcol, 2); - modexputPixel(page, x+k+romFontsData.chw, y+i, romFontsData.l[i] & j ? col:bgcol); - else - //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' '); - //printf("%c", l[i] & j ? '*':' '); - romFontsData.z[k]=romFontsData.l[i] & j ? '*':' '; - j>>=1; - k++; + /* vertical drawing routine by joncampbell123. + * + * optimize for VGA mode X planar memory to minimize the number of times we do I/O write to map mask register. + * so, we enumerate over columns (not rows!) to draw every 4th pixel. bit masks are used because of the font bitmap. + * + * NTS: addr defines what VGA memory address we use, "x" is redundant except to specify which of the 4 pixels we select in the map mask register. */ + word drawaddr; + word colm, row; + byte fontbyte; + byte plane; + byte m1,m2; + + plane = x & 3; + m1 = 0x80; // left half + m2 = 0x08; // right half + for (colm=0;colm < 4;colm++) { + drawaddr = addr; + modexSelectPlane(PLANE(plane)); + for (row=0;row < 8;row++) { + fontbyte = romFontsData.l[row]; + vga_state.vga_graphics_ram[drawaddr ] = (fontbyte & m1) ? col : bgcol; + vga_state.vga_graphics_ram[drawaddr+1] = (fontbyte & m2) ? col : bgcol; + drawaddr += page->width >> 2; } - if(!q) - { - for(k=0;k<9;k++) - { - printf("%c", romFontsData.z[k]); - } - printf("\n"); + + m1 >>= 1; + m2 >>= 1; + if ((++plane) == 4) { + addr++; + plane = 0; } } - romFontsData.chw += k; } diff --git a/src/lib/modex16/16render.h b/src/lib/modex16/16render.h index 308944c3..abf8f1f5 100755 --- a/src/lib/modex16/16render.h +++ b/src/lib/modex16/16render.h @@ -36,6 +36,6 @@ void modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp); /*pbuf ver void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp); void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); -void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q); +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, word addr); #endif diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 41634957..e9a9fc15 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -489,6 +489,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) //cannot print number value du to it being slow as bakapee #else PBUFBFUN (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); + /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ + //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); #endif break; @@ -597,9 +599,9 @@ void shinku(map_view_t *pip, global_game_variables_t *gv) word bgcol = 0; word type = 1; //t=(((*(gv->clock))-gv->clock_start) /18.2); - //sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); - printf("%f fps", (double)gv->kurokku.tiku/ticktock(gv)); - //modexprint(pip[1].page, 16, 16, 1, 15, 0, gv->pee, 1); + sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); + printf("%s", gv->pee); + //modexprint(pip[1].page, 16, 16, 1, 15, 0, gv->pee); //(gv->clock_start)=*(gv->clock); gv->kurokku.tiku=0; } @@ -613,7 +615,8 @@ void shinku(map_view_t *pip, global_game_variables_t *gv) break; case 1: //turn this off if XT - modexWaitBorder(); + //modexWaitBorder(); + vga_wait_for_vsync(); gv->kurokku.frames_per_second=60; break; } @@ -662,6 +665,10 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll } #ifdef SPRITE +// #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32, PLAYERBMPDATA); +// #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); +// #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA); +// #define FRAME4 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32, PLAYERBMPDATA); #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA); diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index b39e95b0..77065af9 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -33,8 +33,14 @@ #include "src/lib/16_timer.h" #include "src/lib/wcpu/wcpu.h" +#include +#include +#include +#include +#include + //#define SPRITE -#define TILERENDER +//#define TILERENDER #define PBUFSFUN modexDrawSpritePBufRegion #define PBUFBFUN modexDrawBmpPBufRegion diff --git a/src/palettel.c b/src/palettel.c index d07452b6..5ce5c809 100755 --- a/src/palettel.c +++ b/src/palettel.c @@ -45,7 +45,7 @@ main(int argc, char *argv[]) modexLoadPalFile(bakapee, &pal); modexPalUpdate1(pal); modexFadeOn(1, pal); - pdump(&gvar.video.page[0]); + modexpdump(&gvar.video.page[0]); getch(); VGAmodeX(0, 0, &gvar); modexPalUpdate1(pal); diff --git a/src/planrpcx.c b/src/planrpcx.c index 06b1f29c..d3ac3bef 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -41,8 +41,6 @@ void main(int argc, char *argv[]) { byte l[1024]; - static byte e; - static word chx, chy, colpee; byte pee[2]; //w=0; @@ -124,25 +122,6 @@ getch(); } } - chx=0; - chy=0; - colpee=32; - for(e=0x00; e<=0xFE; e++) - { - if(chx+8>(gvar.video.page[0].width/2)) - { - chx=0; - chy+=8; - sprintf(pee,"%u", colpee); - modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0); - //getch(); - } - modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0); - chx+=9; - colpee++; - if(colpee>=32+24) colpee=32; - } - fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n"); fprintf(stderr,"version %s\n", VERSION); fprintf(stderr,"%d\n", sizeof(p.plane)); diff --git a/src/scroll.c b/src/scroll.c index 53b86d6b..b1b9d5ae 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -34,7 +34,6 @@ static map_t map; player_t player[MaxPlayers]; //page_t screen, gvar.video.page[1], gvar.video.page[2]; map_view_t mv[3]; -map_view_t *bg, *spri, *mask;//, *tmp; bitmap_t p; word pn=0; static planar_buf_t huge *pp; @@ -85,8 +84,6 @@ void main(int argc, char *argv[]) return; } - testcontrolnoisy=0; - player[0].persist_aniframe=0; player[0].speed=4; //player[0].data = &pp; @@ -137,7 +134,7 @@ void main(int argc, char *argv[]) modexFadeOff(4, dpal); #endif - textInit(); + //textInit(); VGAmodeX(bakapee, 1, &gvar); // printf("%dx%d\n", gvar.video.page[0].sw, gvar.video.page[0].sh); #ifdef FADE @@ -148,7 +145,7 @@ void main(int argc, char *argv[]) //++++ player[0].data.offset=(paloffset/3); //++++ modexPalUpdate1(&player[0].data, &paloffset, 0, 0); //modexPalUpdate1(p.palette); - modexPalUpdate1(map.tiles->btdata->palette); +//++++0000 modexPalUpdate1(map.tiles->btdata->palette); //printf(" %d\n", sizeof(ptmp->data)); //printf("1: %d\n", paloffset); //++++ map.tiles->data->offset=(paloffset/3); @@ -168,7 +165,7 @@ void main(int argc, char *argv[]) /* setup camera and screen~ */ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); gvar.video.page[0].width += (TILEWH*2); - gvar.video.page[0].height += (TILEWH*2);//+QUADWH; + gvar.video.page[0].height += (TILEWH*2); mv[0].page = &gvar.video.page[0]; gvar.video.page[1] = modexNextPage(mv[0].page); mv[1].page = &gvar.video.page[1]; @@ -178,51 +175,25 @@ void main(int argc, char *argv[]) mv[2].page = &gvar.video.page[2]; /* set up paging */ - bg = &mv[0]; - spri = &mv[1]; - mask = &mv[2]; -//IN_Ack(); //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(bg, 0, 0); - mapGoTo(spri, 0, 0); + mapGoTo(&mv[0], 0, 0); + mapGoTo(&mv[1], 0, 0); //mapGoTo(mask, 0, 0); -//IN_Ack(); //TODO: put player in starting position of spot //default player position on the viewable map - player[0].tx = bg->tx + bg->page->tilemidposscreenx; - player[0].ty = bg->ty + bg->page->tilemidposscreeny; - player[0].x = player[0].tx*TILEWH; - player[0].y = player[0].ty*TILEWH; - player[0].triggerx = player[0].tx; - player[0].triggery = player[0].ty+1; -/* player[0].info.x = player[0].tx; - player[0].info.xaxis = player[0].tx*TILEWH; - player[0].info.y = player[0].ty; - player[0].info.yaxis = player[0].ty*TILEWH;*/ - player[0].q=1; - player[0].d=2; - player[0].hp=4; -// player[0].persist_aniframe=0; - //npc - /*npc0.tx = bg->tx + 1; - npc0.ty = bg->ty + 1; - npc0.x = npc0.tx*TILEWH; - npc0.y = npc0.ty*TILEWH; - npc0.triggerx = npc0.tx; - npc0.triggery = npc0.ty+1; - npc0.q=1; - npc0.d=0; - modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/ + player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx; + player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny; + IN_initplayer(&player, 0); modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); #ifndef SPRITE modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15); #else - //PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA); - PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp); + //PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA); + PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp); #endif - modexShowPage(spri->page); + modexShowPage(mv[1].page); //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1); #ifdef MODEX #ifdef FADE @@ -252,18 +223,18 @@ void main(int argc, char *argv[]) { case 0: //bg - bg->page->dx++; - modexShowPage(bg->page); + mv[0].page->dx++; + modexShowPage(mv[0].page); break; case 1: //spri - spri->page->dx++; - modexShowPage(spri->page); + mv[1].page->dx++; + modexShowPage(mv[1].page); break; case 2: //fg - mask->page->dx++; - modexShowPage(mask->page); + mv[2].page->dx++; + modexShowPage(mv[2].page); break; } panq++; @@ -279,18 +250,18 @@ void main(int argc, char *argv[]) { case 0: //bg - bg->page->dx--; - modexShowPage(bg->page); + mv[0].page->dx--; + modexShowPage(mv[0].page); break; case 1: //spri - spri->page->dx--; - modexShowPage(spri->page); + mv[1].page->dx--; + modexShowPage(mv[1].page); break; case 2: //fg - mask->page->dx--; - modexShowPage(mask->page); + mv[2].page->dx--; + modexShowPage(mv[2].page); break; } panq++; @@ -306,18 +277,18 @@ void main(int argc, char *argv[]) { case 0: //bg - bg->page->dy--; - modexShowPage(bg->page); + mv[0].page->dy--; + modexShowPage(mv[0].page); break; case 1: //spri - spri->page->dy--; - modexShowPage(spri->page); + mv[1].page->dy--; + modexShowPage(mv[1].page); break; case 2: //fg - mask->page->dy--; - modexShowPage(mask->page); + mv[2].page->dy--; + modexShowPage(mv[2].page); break; } panq++; @@ -333,18 +304,18 @@ void main(int argc, char *argv[]) { case 0: //bg - bg->page->dy++; - modexShowPage(bg->page); + mv[0].page->dy++; + modexShowPage(mv[0].page); break; case 1: //spri - spri->page->dy++; - modexShowPage(spri->page); + mv[1].page->dy++; + modexShowPage(mv[1].page); break; case 2: //fg - mask->page->dy++; - modexShowPage(mask->page); + mv[2].page->dy++; + modexShowPage(mv[2].page); break; } panq++; @@ -356,7 +327,7 @@ void main(int argc, char *argv[]) //the scripting stuf.... //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) - if(((bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) + if(((mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) { short i; for(i=800; i>=400; i--) @@ -368,19 +339,19 @@ void main(int argc, char *argv[]) if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; } //debugging binds! //if(IN_KeyDown(0x0E)) while(1){ if(xmsmalloc(24)) break; } - if(IN_KeyDown(2)){ modexShowPage(bg->page); panpagenum=0; } - if(IN_KeyDown(3)){ modexShowPage(spri->page); panpagenum=1; } - if(IN_KeyDown(4)){ modexShowPage(mask->page); panpagenum=2; } - if(IN_KeyDown(25)){ pdump(bg->page); pdump(spri->page); } //p + if(IN_KeyDown(2)){ modexShowPage(mv[0].page); panpagenum=0; } + if(IN_KeyDown(3)){ modexShowPage(mv[1].page); panpagenum=1; } + if(IN_KeyDown(4)){ modexShowPage(mv[2].page); panpagenum=2; } + if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); } //p #ifdef MODEX #ifdef FADE - if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg->page); pdump(spri->page); } + if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); } if(IN_KeyDown(22)){ paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0); printf("1paloffset = %d\n", paloffset/3); modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); - pdump(bg->page); pdump(spri->page); } + modexpdump(mv[0].page); modexpdump(mv[1].page); } #endif #endif //pan switch @@ -436,8 +407,8 @@ void main(int argc, char *argv[]) IN_Shutdown(); printf("Project 16 scroll.exe. This is just a test file!\n"); printf("version %s\n", VERSION); - printf("tx: %d\n", bg->tx); - printf("ty: %d\n", bg->ty); + printf("tx: %d\n", mv[0].tx); + printf("ty: %d\n", mv[0].ty); printf("player[0].x: %d", player[0].x); printf(" player[0].y: %d\n", player[0].y); //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8); //else printf("\nplayer[0].y: %d\n", player[0].y); @@ -445,7 +416,7 @@ void main(int argc, char *argv[]) printf("player[0].triggx: %d", player[0].triggerx); printf(" player[0].triggy: %d\n", player[0].triggery); printf("player[0].hp: %d", (player[0].hp)); printf(" player[0].q: %d", player[0].q); printf(" player[0].info.dir: %d", player[0].info.dir); printf(" player[0].d: %d\n", player[0].d); printf("pdir=%d\n", player[0].pdir); - printf("tile data value at player trigger position: %d\n", bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]); + printf("tile data value at player trigger position: %d\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]); // printf("palette offset: %d\n", paloffset/3); //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); //++++ printf("Total free: %zu\n", GetFreeSize()); @@ -460,7 +431,7 @@ void main(int argc, char *argv[]) // printf("\n"); // printf("player[0].info.x: %d", player[0].info.xaxis); printf(" player[0].info.y: %d\n", player[0].info.yaxis); // printf("player[0].info.tx: %d", player[0].info.x); printf(" player[0].info.ty: %d\n", player[0].info.y); - //printf("map.width=%d map.height=%d map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]); + //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]); switch(detectcpu()) { diff --git a/vrl2vrs b/vrl2vrs index b67956b7..cee2d1d5 100755 Binary files a/vrl2vrs and b/vrl2vrs differ diff --git a/vrsdump b/vrsdump index dbaba30e..a75a903a 100755 Binary files a/vrsdump and b/vrsdump differ