From: Jonathan Campbell Date: Fri, 27 May 2016 19:56:41 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=dd532df1ba5c28f9efe78c512052563086381e9b;hp=afebb0aa9e93ca48e0955877d5cbd883e650d35f;p=16.git Merge remote-tracking branch 'upstream/master' --- diff --git a/.gitignore b/.gitignore index 61aa5c76..3f07a93e 100755 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ TODO~ LICENCE~ *.mah *.MAH +!makefile !modex.lib img !.git/config diff --git a/.gitmodules b/.gitmodules index 5586d575..a142f3bc 100755 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,11 @@ [submodule "src/lib/jsmn"] path = src/lib/jsmn url = https://github.com/zserge/jsmn.git + +[submodule "CatacombApocalypse"] + path = 16/CatacombApocalypse + url = https://github.com/FlatRockSoft/CatacombApocalypse.git + +[submodule "wolf3d"] + path = 16/wolf3d + url = https://github.com/id-Software/wolf3d.git diff --git a/16/CatacombApocalypse b/16/CatacombApocalypse new file mode 160000 index 00000000..374403ea --- /dev/null +++ b/16/CatacombApocalypse @@ -0,0 +1 @@ +Subproject commit 374403ea47e9f6d69829c518c6ebee779b314703 diff --git a/16/wolf3d b/16/wolf3d new file mode 160000 index 00000000..05167784 --- /dev/null +++ b/16/wolf3d @@ -0,0 +1 @@ +Subproject commit 05167784ef009d0d0daefe8d012b027f39dc8541 diff --git a/SCROLL.16L b/SCROLL.16L new file mode 100755 index 00000000..c1cf1cc5 --- /dev/null +++ b/SCROLL.16L @@ -0,0 +1,24 @@ +starting timer ok +index=4096 +chkmap ok Project 16 scroll.exe. This is just a test file! +version May 9 2016 02:45:56 +tx: 0 +ty: 0 +player.x: 160 player.y: 128 +player.tx: 10 player.ty: 8 +player.triggx: 10 player.triggy: 9 +player.hp: 4 player.q: 1 player.info.dir: 2 player.d: 2 pdir=0 +tile data value at player trigger position: 0 +Virtual Screen: 352x272 +Screen: 320x240 +virtual tile resolution: 22x17 +tile resolution: 20x15 +middle tile position: 10x8 +video memory remaining: 40447 +page [0]=(a000:0000) size=30208 sw=320 sh=240 width=352 height=272 + [1]=(a000:7600) size=30208 sw=320 sh=240 width=352 height=272 + [2]=(a000:ec00) size=30208 sw=320 sh=240 width=352 height=272 +mv[1].tx: 0 mv[1].ty: 0 panswitch=0 + + +detected CPU type: 386 or newer diff --git a/design.txt b/design.txt index a8c4c054..efb3250f 100755 --- a/design.txt +++ b/design.txt @@ -72,3 +72,14 @@ be used to turn off stack checking, so no stack checking routines get called. [15:07] joncampbell123m the simplest way is to compute a rectangle that covers them all [15:07] joncampbell123m then redraw that. [15:08] joncampbell123m Then optimize the code from there how you handle it + + + + +screen set up 2 rendering screens lock together +1 scrolls the other one follow + +pointers from 2nd screen follows the 1st +size and dimentions and stuff are the same but addresses are different +data is different + diff --git a/dlmkfile b/dlmkfile deleted file mode 100755 index e47a14cc..00000000 --- a/dlmkfile +++ /dev/null @@ -1,56 +0,0 @@ -# do not use GNU make. -# Only use Open Watcom WMAKE - -all: cpu16.exe cpu16h.exe cpu32.exe - -clean: .symbolic - rm -v *.exe *.obj *.map - -DOSLIBDIR=.. -!include $(DOSLIBDIR)/extdep.mak - -# library deps 16-bit large -$(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos86l/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# library deps 16-bit huge -$(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos86h/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# library deps 32-bit flat -$(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos386f/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# NOTE: dos86l = 16-bit large memory model. memory model must match! -cpu16.exe: cpu16.obj $(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib $(DOSLIBDIR)/hw/dos/dos86l/dos.lib - %write tmp.cmd option quiet option map=cpu16.map $(DOSLIB_LDFLAGS_DOS16L) file cpu16.obj name cpu16.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos86l/dos.lib - @wlink @tmp.cmd -cpu16.obj: cpu.c - wcl $(FLAGS) -fo=cpu16.obj -ml $(DOSLIB_CFLAGS_DOS16L) -c cpu.c - -# NOTE: dos86h = 16-bit huge memory model. memory model must match! -cpu16h.exe: cpu16h.obj $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib $(DOSLIBDIR)/hw/dos/dos86h/dos.lib - %write tmp.cmd option quiet option map=cpu16h.map $(DOSLIB_LDFLAGS_DOS16H) file cpu16h.obj name cpu16h.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos86h/dos.lib - @wlink @tmp.cmd -cpu16h.obj: cpu.c - wcl $(FLAGS) -fo=cpu16h.obj -mh $(DOSLIB_CFLAGS_DOS16H) -c cpu.c - -# NOTE: dos386f = 32-bit flat memory model. memory model must match! -cpu32.exe: cpu32.obj $(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib $(DOSLIBDIR)/hw/dos/dos386f/dos.lib - %write tmp.cmd option quiet option map=cpu32.map $(DOSLIB_LDFLAGS_DOS32) file cpu32.obj name cpu32.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos386f/dos.lib - @wlink @tmp.cmd -cpu32.obj: cpu.c - wcl386 $(FLAGS) -fo=cpu32.obj -mf $(DOSLIB_CFLAGS_DOS32) -c cpu.c - diff --git a/git_modu.les b/git_modu.les index 5586d575..a142f3bc 100755 --- a/git_modu.les +++ b/git_modu.les @@ -5,3 +5,11 @@ [submodule "src/lib/jsmn"] path = src/lib/jsmn url = https://github.com/zserge/jsmn.git + +[submodule "CatacombApocalypse"] + path = 16/CatacombApocalypse + url = https://github.com/FlatRockSoft/CatacombApocalypse.git + +[submodule "wolf3d"] + path = 16/wolf3d + url = https://github.com/id-Software/wolf3d.git diff --git a/makefile b/makefile index ee23f2f2..a9583f13 100755 --- a/makefile +++ b/makefile @@ -26,6 +26,12 @@ # -zk0 kanji support~ # -zkl current codepage +# this enables debug output to the serial port. +# comment this out on game release. +# serial output goes to COM1 at 9600 baud 1 stop bit odd parity. +# serial output is plain text ASCII. +DEBUGSERIAL=1 + #%.C #192x144 #wwww will add these @@ -63,10 +69,10 @@ WLIBQ=-q WCLQ=-zq $(WLIBQ) UPXQ=-qqq -AFLAGS=-mh -0 -d1 +AFLAGS=-mh -0 -d2 16FLAGS=-fh=16.hed BAKAPIFLAGS=-fh=bakapi.hed -SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#55808#60000 +SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#54096#60000 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS) ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo -i$(DOSLIB)##wwww @@ -75,29 +81,35 @@ FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) PCX2VRL=$(DOSLIBDIR)/hw/vga/pcx2vrl -#DOSLIBEXMMOBJ = himemsys.$(OBJ) emm.$(OBJ) VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) -16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) +16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(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 -#$(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 -#testemm.exe testemm0.exe fonttes0.exe miditest.exe sega.exe sountest.exe +!ifeq DEBUGSERIAL 1 +FLAGS += -DDEBUGSERIAL +DOSLIBOBJ += 8250.$(OBJ) +DOSLIBLIBS += $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250$(DIRSEP)dos86h$(DIRSEP)8250.lib +!endif + +TESTEXEC = exmmtest.exe test.exe test0.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 + EXEC = 16.exe bakapi.exe $(TESTEXEC) tesuto.exe all: $(EXEC) joytest.exe vrs - -#$(16LIBOBJS) => 16.lib bug.... +#16.lib => $(16LIBOBJS) bug.... +16LIB=$(16LIBOBJS) +!ifeq DEBUGSERIAL 1 +16LIB += $(DOSLIBLIBS) +!endif # #game and bakapi executables # -16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib - wcl $(FLAGS) $(16FLAGS) 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=16.mah +16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib + wcl $(FLAGS) $(16FLAGS) 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib -fm=16.mah bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS) wcl $(FLAGS) $(BAKAPIFLAGS) bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS) -fm=bakapi.mah @@ -105,15 +117,15 @@ bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS) # #Test Executables! # -scroll.exe: scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib - wcl $(FLAGS) scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=scroll.mah +scroll.exe: scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib + wcl $(FLAGS) scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib -fm=scroll.mah scroll.$(OBJ): $(SRC)scroll.c wcl $(FLAGS) -c $(SRC)scroll.c # NOTE: dos86h = 16-bit huge memory model. memory model must match! tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib -# %write tmp.cmd option quiet option map=tesuto.mah $(DOSLIB_LDFLAGS_DOS16H) file tesuto.obj name tesuto.exe +# %write tmp.cmd option quiet option max=tesuto.mah $(DOSLIB_LDFLAGS_DOS16H) file tesuto.obj name tesuto.exe # %write tmp.cmd library $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib # %write tmp.cmd library $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib # @wlink @tmp.cmd @@ -121,47 +133,38 @@ tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib tesuto.$(OBJ): $(SRC)tesuto.c wcl $(FLAGS) $(WCLQ) -c $(SRC)tesuto.c -test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) - wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) -fm=test.mah - -test2.exe: test2.$(OBJ) gfx.lib - wcl $(FLAGS) test2.$(OBJ) gfx.lib -fm=test2.mah +test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) $(DOSLIBLIBS) $(16LIB) + wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) $(DOSLIBLIBS) $(16LIB) -fm=test.mah -fonttest.exe: fonttest.$(OBJ) $(16LIBOBJS) gfx.lib - wcl $(FLAGS) fonttest.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fonttest.mah +test2.exe: test2.$(OBJ) $(DOSLIBLIBS) gfx.lib + wcl $(FLAGS) test2.$(OBJ) $(DOSLIBLIBS) gfx.lib -fm=test2.mah -#fonttes0.exe: fonttes0.$(OBJ) $(16LIBOBJS) -# wcl $(FLAGS) fonttes0.$(OBJ) $(16LIBOBJS) +test0.exe: test0.$(OBJ) + wcl $(FLAGS) test0.$(OBJ) -fm=test0.mah -fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) - wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) -fm=fontgfx.mah +fonttest.exe: fonttest.$(OBJ) $(16LIB) gfx.lib + wcl $(FLAGS) fonttest.$(OBJ) $(16LIB) gfx.lib -fm=fonttest.mah -inputest.exe: inputest.$(OBJ) $(16LIBOBJS) - wcl $(FLAGS) inputest.$(OBJ) $(16LIBOBJS) -fm=inputest.mah +#fonttes0.exe: fonttes0.$(OBJ) $(16LIB) +# wcl $(FLAGS) fonttes0.$(OBJ) $(16LIB) -#sountest.exe: sountest.$(OBJ) $(16LIBOBJS) -# wcl $(FLAGS) sountest.$(OBJ) $(16LIBOBJS) +fontgfx.exe: fontgfx.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS) + wcl $(FLAGS) fontgfx.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS) -fm=fontgfx.mah -#miditest.exe: miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ) -# wcl $(FLAGS) miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ) +inputest.exe: inputest.$(OBJ) $(16LIB) + wcl $(FLAGS) inputest.$(OBJ) $(16LIB) -fm=inputest.mah -tsthimem.exe: tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) - wcl $(FLAGS) tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) -fm=tsthimem.mah - -#testemm.exe: testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) -# wcl $(FLAGS) testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) - -#testemm0.exe: testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) -# wcl $(FLAGS) testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) +#sountest.exe: sountest.$(OBJ) $(16LIB) +# wcl $(FLAGS) sountest.$(OBJ) $(16LIB) pcxtest.exe: pcxtest.$(OBJ) gfx.lib wcl $(FLAGS) pcxtest.$(OBJ) gfx.lib -fm=pcxtest.mah -palettec.exe: palettec.$(OBJ) gfx.lib #$(16LIBOBJS) - wcl $(FLAGS) palettec.$(OBJ) gfx.lib -fm=palettec.mah #$(16LIBOBJS) +palettec.exe: palettec.$(OBJ) gfx.lib #$(16LIB) + wcl $(FLAGS) palettec.$(OBJ) gfx.lib -fm=palettec.mah #$(16LIB) -palettel.exe: palettel.$(OBJ) gfx.lib #$(16LIBOBJS) - wcl $(FLAGS) palettel.$(OBJ) gfx.lib -fm=palettel.mah #$(16LIBOBJS) +palettel.exe: palettel.$(OBJ) gfx.lib #$(16LIB) + wcl $(FLAGS) palettel.$(OBJ) gfx.lib -fm=palettel.mah #$(16LIB) pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.mah @@ -169,26 +172,17 @@ pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib planrpcx.exe: planrpcx.$(OBJ) gfx.lib wcl $(FLAGS) planrpcx.$(OBJ) gfx.lib -fm=planrpcx.mah -maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib - wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=maptest.mah - -#maptest0.exe: maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ) -# wcl $(FLAGS) $(MFLAGS) maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ) - -#emmtest.exe: emmtest.$(OBJ) memory.$(OBJ) -# wcl $(FLAGS) $(MFLAGS) emmtest.$(OBJ) memory.$(OBJ) +maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib + wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib -fm=maptest.mah -#emsdump.exe: emsdump.$(OBJ) memory.$(OBJ) -# wcl $(FLAGS) $(MFLAGS) emsdump.$(OBJ) memory.$(OBJ) +fmemtest.exe: fmemtest.$(OBJ) $(16LIB) + wcl $(FLAGS) fmemtest.$(OBJ) $(16LIB) -fm=fmemtest.mah -fmemtest.exe: fmemtest.$(OBJ) $(16LIBOBJS) - wcl $(FLAGS) fmemtest.$(OBJ) $(16LIBOBJS) -fm=fmemtest.mah +exmmtest.exe: exmmtest.$(OBJ) $(16LIB) + wcl $(FLAGS) exmmtest.$(OBJ) -fm=exmmtest.mah $(16LIB) -exmmtest.exe: exmmtest.$(OBJ) $(16LIBOBJS) - wcl $(FLAGS) exmmtest.$(OBJ) -fm=exmmtest.mah $(16LIBOBJS) - -vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIBOBJS) - wcl $(FLAGS) vgmtest.$(OBJ) vgmsnd.lib -fm=vgmtest.mah $(16LIBOBJS) +vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIB) + wcl $(FLAGS) vgmtest.$(OBJ) vgmsnd.lib -fm=vgmtest.mah $(16LIB) #====wcl -mc vgmtest.$(OBJ) $(VGMSNDOBJ) -fm=vgmtest.mah @@ -207,6 +201,9 @@ test.$(OBJ): $(SRC)test.c $(SRCLIB)modex16.h test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)test2.c +test0.$(OBJ): $(SRC)test0.c + wcl $(FLAGS) -c $(SRC)test0.c + pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest.c @@ -277,11 +274,8 @@ vgmtest.$(OBJ): $(SRC)vgmtest.c 16.lib: $(16LIBOBJS)# doslib.lib vgmsnd.lib wlib -b $(WLIBQ) 16.lib $(16LIBOBJS)# doslib.lib vgmsnd.lib -gfx.lib: $(GFXLIBOBJS) - wlib -b $(WLIBQ) gfx.lib $(GFXLIBOBJS) - -#doslib.lib: $(DOSLIBOBJ) # $(SRCLIB)cpu.lib -# wlib -b $(WLIBQ) doslib.lib $(DOSLIBOBJ) # $(SRCLIB)cpu.lib +gfx.lib: $(GFXLIBOBJS) 16_in.$(OBJ) 16_head.$(OBJ) + wlib -b $(WLIBQ) gfx.lib $(GFXLIBOBJS) 16_in.$(OBJ) 16_head.$(OBJ) vgmsnd.lib: $(VGMSNDOBJ) wlib -b $(WLIBQ) vgmsnd.lib $(VGMSNDOBJ) @@ -298,6 +292,8 @@ $(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 +$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250$(DIRSEP)dos86h$(DIRSEP)8250.lib: + cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250 && .$(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 @@ -348,35 +344,12 @@ mapread.$(OBJ): $(SRCLIB)mapread.h $(SRCLIB)mapread.c 16_ca.$(OBJ): $(SRCLIB)16_ca.h $(SRCLIB)16_ca.c wcl $(FLAGS) -c $(SRCLIB)16_ca.c +16_dbg.$(OBJ): $(SRCLIB)16_dbg.h $(SRCLIB)16_dbg.c + wcl $(FLAGS) -c $(SRCLIB)16_dbg.c + midi.$(OBJ): $(SRCLIB)midi.h $(SRCLIB)midi.c wcl $(FLAGS) -c $(SRCLIB)midi.c -# -# doslib stuff -# -adlib.$(OBJ): $(DOSLIB)adlib.h $(DOSLIB)adlib.c - wcl $(FLAGS) -c $(DOSLIB)adlib.c - -8254.$(OBJ): $(DOSLIB)8254.h $(DOSLIB)8254.c - wcl $(FLAGS) -c $(DOSLIB)8254.c - -8259.$(OBJ): $(DOSLIB)8259.h $(DOSLIB)8259.c - wcl $(FLAGS) -c $(DOSLIB)8259.c - -dos.$(OBJ): $(DOSLIB)dos.h $(DOSLIB)dos.c - wcl $(FLAGS) -c $(DOSLIB)dos.c - -cpu.$(OBJ): $(DOSLIB)cpu.h $(DOSLIB)cpu.c - wcl $(FLAGS) -c $(DOSLIB)cpu.c - -himemsys.$(OBJ): $(DOSLIB)himemsys.h $(DOSLIB)himemsys.c - wcl $(FLAGS) -c $(DOSLIB)himemsys.c - -emm.$(OBJ): $(DOSLIB)emm.h $(DOSLIB)emm.c - wcl $(FLAGS) -c $(DOSLIB)emm.c - -# end of doslib stuff - 16_head.$(OBJ): $(SRCLIB)16_head.h $(SRCLIB)16_head.c wcl $(FLAGS) -c $(SRCLIB)16_head.c @@ -397,12 +370,6 @@ vgmSnd.$(OBJ): $(VGMSNDLIB)vgmSnd.h $(VGMSNDLIB)vgmSnd.c wcl $(FLAGS) -c $(VGMSNDLIB)vgmSnd.c #====wcl -c -mc $(VGMSNDLIB)vgmSnd.c -#3812intf.$(OBJ): $(VGMSNDLIB)3812intf.h $(VGMSNDLIB)3812intf.c -# wcl $(FLAGS) -c $(VGMSNDLIB)3812intf.c - -#farjsmn.$(OBJ): $(JSMNLIB)farjsmn.h $(JSMNLIB)farjsmn.c -# wcl $(FLAGS) $(MFLAGS) -c $(JSMNLIB)farjsmn.c - #memory.$(OBJ): $(EXMMLIB)memory.h $(EXMMLIB)memory.c # wcl $(FLAGS) $(MFLAGS) -c $(EXMMLIB)memory.c @@ -493,8 +460,8 @@ uplibs: .symbolic reinitlibs: .symbolic @rm -rf $(SRCLIB)doslib @rm -rf $(SRCLIB)jsmn - #@mkdir $(SRCLIB)doslib - #@mkdir $(SRCLIB)jsmn + @rm -rf 16/CatacombApocalypse + @rm -rf 16/wolf3d @wmake -h initlibs initlibs: .symbolic @@ -504,6 +471,10 @@ initlibs: .symbolic @git clone https://github.com/joncampbell123/doslib.git @git clone https://github.com/zserge/jsmn.git @cd $(PDIR)$(PDIR) + @cd 16 + @git clone https://github.com/FlatRockSoft/CatacombApocalypse.git + @git clone https://github.com/id-Software/wolf3d.git + @cd $(PDIR) ## ## experimental libs diff --git a/scroll.smp b/scroll.smp index 96cd888f..865f458d 100755 Binary files a/scroll.smp and b/scroll.smp differ diff --git a/src/16.c b/src/16.c index 990a2115..380c3359 100755 --- a/src/16.c +++ b/src/16.c @@ -53,6 +53,13 @@ main(int argc, char *argv[]) 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 + //screen = modexDefaultPage(); engi_stat = ENGI_RUN; textInit(); diff --git a/src/16.h b/src/16.h index bb870326..cb3cbbf4 100755 --- a/src/16.h +++ b/src/16.h @@ -30,6 +30,7 @@ //#include "src/lib/planar.h" #include "src/lib/scroll16.h" #include "src/lib/16_timer.h" +#include "src/lib/16_dbg.h" typedef enum { ENGI_EXIT, diff --git a/src/bakapi.c b/src/bakapi.c index 33388702..5378794a 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -90,8 +90,8 @@ main(int argc, char *argvar[]) // main variables values d=4; // switch variable key=2; // default screensaver number - xpos=TILEWH*2; - ypos=TILEWH*2; + xpos=TILEWHD; + ypos=TILEWHD; xdir=1; ydir=1; @@ -111,8 +111,6 @@ main(int argc, char *argvar[]) /* 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); textInit(); //modexPalUpdate(bmp.palette); //____ @@ -200,7 +198,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); + //fprintf(stderr, "dx=%d dy=%d ", gvar.video.page[0].dx, gvar.video.page[0].dy); printf("Tiled mode is "); switch (bakapee.tile) { @@ -264,10 +262,8 @@ pee: case '6': case '9': key = c - '0'; - gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); - gvar.video.page[0].width += (TILEWH*2); - gvar.video.page[0].height += (TILEWH*2); VGAmodeX(vgamodex_mode, 0, &gvar); + gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in. // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C. modexShowPage(&gvar.video.page[0]); @@ -311,6 +307,7 @@ pee: } VGAmodeX(0, 1, &gvar); #endif // defined(BOINK) +// printf("page.width=%u ", gvar.video.page[0].width); printf("page.height=%u\n", gvar.video.page[0].height); printf("bakapi ver. 1.04.16.04\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v3\n"); printf("compiled on 2016/04/04\n"); } diff --git a/src/bakapi.h b/src/bakapi.h index 729e3b19..9a3821fa 100755 --- a/src/bakapi.h +++ b/src/bakapi.h @@ -25,7 +25,7 @@ #include "src/lib/bakapee.h" -//project 16 testing define switch for veiwing the contents of the video memory +//project 16 testing define switch for veiwing the contents of the video memory --sparky4 #define BOINK // what does this mean? --J.C. #endif /*__BAKAPI_H_*/ diff --git a/src/lib/16_dbg.c b/src/lib/16_dbg.c new file mode 100644 index 00000000..be2c1d26 --- /dev/null +++ b/src/lib/16_dbg.c @@ -0,0 +1,61 @@ + +#include "src/16.h" + +// TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?" +#ifdef DEBUGSERIAL +unsigned char _DEBUG_INITed = 0; +struct info_8250 *_DEBUG_uart = NULL; + +int _DEBUG_INIT() { + if (!_DEBUG_INITed) { + unsigned int i; + uint16_t port; + + if (!init_8250()) return 0; + + // what does the BIOS say the serial ports are? + probe_8250_bios_ports(); + for (i=0;i < bios_8250_ports;i++) { + port = get_8250_bios_port(i); + if (port == 0) continue; + probe_8250(port); + } + + // what about the standard serial ports? + for (i=0;i < (sizeof(standard_8250_ports)/sizeof(standard_8250_ports[0]));i++) { + port = standard_8250_ports[i]; + if (port == 0) continue; + probe_8250(port); + } + + // pick the first port, which is probably COM1 + if (base_8250_ports == 0) return 0; // FIXME: You know "base_8250_ports" is probably a bad variable name for the max entries in info_8250_port[] + _DEBUG_uart = &info_8250_port[0]; + _DEBUG_INITed = 1; + + // init the COM port. + // in DOSBox-X, the "log" mode will receive our text and print it into the log file + // on real hardware, our text will likely go over a null modem cable to another PC running a serial terminal program like PuTTY or minicom. + // if nothing is connected, then the bytes go off into the ether to get lost and life goes on. + uart_8250_enable_interrupt(_DEBUG_uart,0); // disable interrupts + uart_8250_set_FIFO(_DEBUG_uart,0x07); // enable FIFO (why not?), also clear xmit/recv FIFO buffers, set threshhold to 1 byte + uart_8250_set_MCR(_DEBUG_uart,3); // RTS and DTS on + uart_8250_set_line_control(_DEBUG_uart,UART_8250_LCR_8BIT | UART_8250_LCR_PARITY); // 8 bit 1 stop bit odd parity + uart_8250_set_baudrate(_DEBUG_uart,uart_8250_baud_to_divisor(_DEBUG_uart,9600)); // 9600 baud + } + + return _DEBUG_INITed; +} + +void _DEBUG(const char *msg) { + if (_DEBUG_uart != NULL) { + char c; + + while ((c=(*msg++)) != 0/*NUL*/) { + while (!uart_8250_can_write(_DEBUG_uart)); // wait for the UART to indicate readiness for our output + uart_8250_write(_DEBUG_uart,(uint8_t)c); // then write it + } + } +} +#endif + diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h new file mode 100644 index 00000000..e408ac0c --- /dev/null +++ b/src/lib/16_dbg.h @@ -0,0 +1,21 @@ + +#ifndef _SRC_LIB_16_DBG +#define _SRC_LIB_16_DBG + +# ifdef DEBUGSERIAL +# include + +void _DEBUG(const char *msg); +int _DEBUG_INIT(); +# else +static inline void _DEBUG(const char *msg) { + // NOTHING +} + +static inline int _DEBUG_INIT() { + // NOTHING + return -1; +} +# endif +#endif // _SRC_LIB_16_DBG + diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 5bccecaf..3c16d32a 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -1297,4 +1297,7 @@ void IN_initplayer(player_t *player, word pn) player[pn].q=1; player[pn].d=2; player[pn].hp=4; + player[pn].speed=4; + player[pn].persist_aniframe=0; + player[pn].spt=(TILEWH/(player[pn].speed)); //speed per tile wwww } diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 78ebd805..beb6a3d3 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -32,6 +32,7 @@ #include "src/lib/16_timer.h" #include "src/lib/bitmap.h" #include "src/lib/planar.h" +#include "src/lib/16_dbg.h" #ifdef __DEBUG__ //#define __DEBUG_InputMgr__ @@ -225,6 +226,7 @@ typedef struct byte near pdir; //previous direction~ //byte near kd[2]; //array of arrow key pressed word speed; //player speed! + word spt; //speed per tile //0000 planar_buf_t huge *data; //supposively the sprite sheet data // planar_buf_t data; //supposively the sprite sheet data ////0000---- diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c index b50c16e1..dfc47681 100755 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -266,7 +266,7 @@ void ding(page_t *page, bakapee_t *pee, word q) ty+=pee->yy+TILEWH+4; modexClearRegion(page, tx, ty, 4, 4, pee->coor); if(pee->tile) - modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); + modexClearRegion(page, (rand()*4)%page->width, (rand()*4)%(page->height), 4, 4, 0); else modexputPixel(page, rand()%page->width, rand()%(page->height), 0); //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); diff --git a/src/lib/doslib b/src/lib/doslib index ef2fcb68..66fbae21 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit ef2fcb68ef3c2f9ab023bd455acf488fda73c6eb +Subproject commit 66fbae215b0f2f253a37a03bd5f1ac6870f25c55 diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 5db7bf48..1e6a2fcc 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -85,6 +85,9 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) vgaSetMode(VGA_256_COLOR_MODE); vga_enable_256color_modex(); + /* reprogram the CRT controller */ +// outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */ +// outp(CRTC_DATA, 0x7f); /* get current write protect on varios regs */ update_state_from_vga(); vga_read_crtc_mode(&cm); @@ -92,6 +95,9 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) { case 1: //CRTParmCount = sizeof(ModeX_320x240regs) / sizeof(ModeX_320x240regs[0]); + /*for(i=0; ivideo.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 @@ -148,17 +154,18 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) } break; } - gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH; - gv->video.page[0].tilesh = gv->video.page[0].sh/TILEWH; + +// gv->video.page[0].tw = gv->video.page[0].sw/TILEWH; +// gv->video.page[0].th = gv->video.page[0].sh/TILEWH; + //TODO MAKE FLEXIBLE~ - gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; - gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; - #define PAGE_SIZE (word)(gv->video.page[0].sw/4 * gv->video.page[0].sh) +// gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; +// gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; } void modexLeave() { - /* TODO restore original mode and palette */ + /* VGAmodeX restores original mode and palette */ vgaSetMode(TEXT_MODE); } @@ -168,20 +175,23 @@ modexDefaultPage(page_t *p) page_t page; /* default page values */ - page.data = vga_state.vga_graphics_ram;//VGA; + //page.data = VGA; + //page.data = (byte far *)(vga_state.vga_graphics_ram); + page.data = (vga_state.vga_graphics_ram); page.dx = 0; page.dy = 0; page.sw = p->sw; page.sh = p->sh; - page.width = p->sw; - page.height = p->sh; + page.width = p->sw+TILEWHD; + page.height = p->sh+TILEWHD; page.tw = page.sw/TILEWH; page.th = page.sh/TILEWH; + page.tilesw=page.width/TILEWH; + page.tilesh=page.height/TILEWH; page.tilemidposscreenx = page.tw/2; page.tilemidposscreeny = (page.th/2)+1; - page.tilesw=p->tilesw; - page.tilesh=p->tilesh; - //pageSize = p->sw*p->sh; + page.stridew=page.width/4; + page.pagesize = (word)(page.width/4)*page.height; page.id = 0; return page; @@ -194,17 +204,22 @@ page_t modexNextPage(page_t *p) { page_t result; - result.data = p->data + (p->width/4)*p->height; + result.data = p->data + (p->pagesize); result.dx = 0; result.dy = 0; + result.sw = p->sw; + result.sh = p->sh; result.width = p->width; result.height = p->height; - result.tw = p->width/TILEWH; - result.th = p->height/TILEWH; + result.tw = p->tw; + result.th = p->th; + result.tilesw = p->tilesw; + result.tilesh = p->tilesh; result.id = p->id+1; + result.stridew=p->stridew; + result.pagesize = p->pagesize; return result; -// return modexNextPageFlexibleSize(&p, p->width, p->height); } //next page with defined dimentions~ @@ -213,18 +228,50 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) { page_t result; - result.data = p->data + (p->width/4)*p->height; /* compute the offset */ + result.data = p->data + (p->pagesize); /* compute the offset */ result.dx = 0; result.dy = 0; + result.sw = x; + result.sh = y; result.width = x; result.height = y; - result.tw = p->width/TILEWH; - result.th = p->height/TILEWH; + result.tw = result.sw/TILEWH; + result.th = result.sh/TILEWH; + result.tilesw=result.width/TILEWH; + result.tilesh=result.height/TILEWH; result.id = p->id+1; + result.stridew=result.width/4; + result.pagesize = (word)(result.width/4)*result.height; return result; } +void modexCalcVmemRemain(video_t *video) +{ + byte i; + //printf("\n\n 1st vmem_remain=%u\n", video->vmem_remain); + for(i=0; inum_of_pages; i++) + { + video->vmem_remain-=video->page[i].pagesize; + //printf(" [%u], video->page[%u].pagesize=%u\n", i, i, video->page[i].pagesize); + //printf(" [%u], vmem_remain=%u\n", i, video->vmem_remain); + } +} + +void modexHiganbanaPageSetup(video_t *video) +{ + video->vmem_remain=65535U; + video->num_of_pages=0; + (video->page[0]) = modexDefaultPage(&(video->page[0])); video->num_of_pages++; //video->page[0].width += (TILEWHD); video->page[0].height += (TILEWHD); + (video->page[1]) = modexNextPage(&(video->page[0])); video->num_of_pages++; + (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), TILEWH*4, TILEWH*4); video->num_of_pages++; + (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 208); video->num_of_pages++; +// (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 172); video->num_of_pages++; +// (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), 72, 128); video->num_of_pages++; + modexCalcVmemRemain(video); + video->p=0; + video->r=1; +} void modexShowPage(page_t *page) { @@ -259,28 +306,25 @@ modexShowPage(page_t *page) { outp(AC_INDEX, (page->dx & 0x03) << 1); } - void modexPanPage(page_t *page, int dx, int dy) { page->dx = dx; page->dy = dy; } - void modexSelectPlane(byte plane) { outp(SC_INDEX, MAP_MASK); /* select plane */ outp(SC_DATA, plane); } - void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { word pageOff = (word) page->data; word xoff=x/4; /* xoffset that begins each row */ word scanCount=w/4; /* number of iterations per row (excluding right clip)*/ - word poffset = pageOff + y*(page->width/4) + xoff; /* starting offset */ - word nextRow = page->width/4-scanCount-1; /* loc of next row */ + word poffset = pageOff + y*(page->stridew) + xoff; /* starting offset */ + word nextRow = page->stridew-scanCount-1; /* loc of next row */ byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ byte rclip[] = {0x00, 0x01, 0x03, 0x07}; byte left = lclip[x&0x03]; @@ -292,6 +336,14 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { } __asm { + PUSHF + PUSH ES + PUSH AX + PUSH BX + PUSH CX + PUSH DX + PUSH SI + PUSH DI MOV AX, SCREEN_SEG ; go to the VGA memory MOV ES, AX MOV DI, poffset ; go to the first pixel @@ -325,6 +377,14 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { ADD DI, nextRow ; go to the next row DEC h JNZ SCAN_START + POP DI + POP SI + POP DX + POP CX + POP BX + POP AX + POP ES + POPF } } @@ -340,17 +400,26 @@ modexCopyPageRegion(page_t *dest, page_t *src, word dx, word dy, word width, word height) { - word doffset = (word)dest->data + dy*(dest->width/4) + dx/4; - word soffset = (word)src->data + sy*(src->width/4) + sx/4; - word scans = width/4; - word nextSrcRow = src->width/4 - scans - 1; - word nextDestRow = dest->width/4 - scans - 1; + word doffset = (word)dest->data + dy*(dest->stridew) + dx/4; + word soffset = (word)src->data + sy*(src->stridew) + sx/4; + word scans = vga_state.vga_stride; + word nextSrcRow = src->stridew - scans - 1; + word nextDestRow = dest->stridew - scans - 1; byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ byte rclip[] = {0x0f, 0x01, 0x03, 0x07}; byte left = lclip[sx&0x03]; byte right = rclip[(sx+width)&0x03]; __asm { + PUSHF + PUSH ES + PUSH AX + PUSH BX + PUSH CX + PUSH DX + PUSH SI + PUSH DI + MOV AX, SCREEN_SEG ; work in the vga space MOV ES, AX ; MOV DI, doffset ; @@ -399,6 +468,15 @@ modexCopyPageRegion(page_t *dest, page_t *src, MOV DX, GC_INDEX+1 ; go back to CPU data MOV AL, 0ffh ; none from latches OUT DX, AL ; + + POP DI + POP SI + POP DX + POP CX + POP BX + POP AX + POP ES + POPF } } @@ -960,6 +1038,15 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c } //load the letter 'A' __asm { + PUSHF + PUSH ES + PUSH AX + PUSH BX + PUSH CX + PUSH DX + PUSH SI + PUSH DI + MOV DI, addr MOV SI, o MOV ES, s @@ -974,6 +1061,15 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c INC DI DEC CX JNZ L1 + + POP DI + POP SI + POP DX + POP CX + POP BX + POP AX + POP ES + POPF } for(i=0; ivmem_remain); + printf("page "); + for(i=0; inum_of_pages;i++) + { + printf(" [%u]=", i); + printf("(%Fp)", (v->page[i].data)); + printf(" size=%u", v->page[i].pagesize); + printf(" sw=%lu sh=%lu ", (unsigned long)v->page[i].sw, (unsigned long)v->page[i].sh); + printf(" width=%lu height=%lu", (unsigned long)v->page[i].width, (unsigned long)v->page[i].height); + printf("\n"); + } +} diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 98551f48..3ba8753c 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -31,7 +31,7 @@ #include "src/lib/modex16/16planar.h" #include "src/lib/16text.h" #include "src/lib/modex16/16render.h" -// #include "src/lib/modex16/320x240.h" +#include "src/lib/modex16/320x240.h" // #include "src/lib/modex16/320x200.h" // #include "src/lib/modex16/256x192.h" // #include "src/lib/modex16/192x144_.h" @@ -66,7 +66,8 @@ static struct pcxHeader { //192x144 = 12x9 //temp defines -#define TILEWH 16 +#define TILEWH 16 +#define TILEWHD TILEWH*2 #define QUADWH TILEWH/2 /* -========================== Types & Macros ==========================- */ @@ -118,6 +119,8 @@ void modexsetBaseXMode(); page_t modexDefaultPage(page_t *p); page_t modexNextPage(page_t *p); page_t modexNextPageFlexibleSize(page_t *p, word x, word y); +void modexCalcVmemRemain(video_t *video); +void modexHiganbanaPageSetup(video_t *video); void modexShowPage(page_t *page); void modexPanPage(page_t *page, int dx, int dy); void modexSelectPlane(byte plane); @@ -182,5 +185,6 @@ void modexpdump(page_t *pee); void modexcls(page_t *page, byte color, byte *Where); void modexWaitBorder(); void bios_cls(); +void modexprintmeminfo(video_t *v); #endif diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 1780d960..312a76e6 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -27,44 +27,48 @@ void walk(map_view_t *pip, player_t *player, word pn) { #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; + //printf("player[%d].d=%d\n", pn, player[pn].d); switch(player[pn].d) { //right movement case 3: - //printf("pip[0].page->tilesw=%d\n", pip[0].page->tilesw); - if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tilesw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && + //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw); + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); + if(!pageflipflop) mapScrollRight(pip, player, !(pip[0].video->p), pn); else{ mapScrollRight(pip, player, 0, pn); mapScrollRight(pip, player, 1, pn); - modexShowPage(pip[1].page); + ScrollRight(pip, player, 2, pn); + ScrollRight(pip, player, 3, pn); } + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } else if(player[pn].tx < pip[0].map->width && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x+=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } else { - modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATA); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx+1; @@ -73,39 +77,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //left movement case 1: - if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tilesw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); + if(!pageflipflop) mapScrollLeft(pip, player, !(pip[0].video->p), pn); else{ mapScrollLeft(pip, player, 0, pn); mapScrollLeft(pip, player, 1, pn); - modexShowPage(pip[1].page); + ScrollLeft(pip, player, 2, pn); + ScrollLeft(pip, player, 3, pn); } + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x-=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } else { - modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATA); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx-1; @@ -114,39 +121,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //down movement case 4: - if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->tilesh < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); + if(!pageflipflop) mapScrollDown(pip, player, !(pip[0].video->p), pn); else{ mapScrollDown(pip, player, 0, pn); mapScrollDown(pip, player, 1, pn); - modexShowPage(pip[1].page); + ScrollDown(pip, player, 2, pn); + ScrollDown(pip, player, 3, pn); } + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } else if(player[pn].ty < pip[0].map->height && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y+=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } else { - modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; @@ -155,39 +165,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //up movement case 0: - if(pip[0].ty > 0 && pip[0].ty+pip[0].page->tilesh <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); + if(!pageflipflop) mapScrollUp(pip, player, !(pip[0].video->p), pn); else{ mapScrollUp(pip, player, 0, pn); mapScrollUp(pip, player, 1, pn); - modexShowPage(pip[1].page); + ScrollUp(pip, player, 2, pn); + ScrollUp(pip, player, 3, pn); } + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y-=(player[pn].speed); animatePlayer(pip, player, 0, pn); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } else { - modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATA); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; @@ -196,6 +209,66 @@ void walk(map_view_t *pip, player_t *player, word pn) } } +//panning page +void panpagemanual(map_view_t *pip, player_t *player, word pn) +{ + switch(player[pn].d) + { + //right movement + case 3: + if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dx+=4; + modexShowPage(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } + } + break; + + //left movement + case 1: + if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dx-=4; + modexShowPage(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } + } + break; + + //down movement + case 4: + if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dy+=4; + modexShowPage(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } + } + break; + + //up movement + case 0: + if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dy-=4; + modexShowPage(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } + } + break; + } + //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); +} + /*map_t allocMap(int w, int h) { map_t result; @@ -303,11 +376,12 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) /* draw the next column */ x= mv[0].page->sw + mv[id].map->tiles->tileWidth; if(player[plid].q%4) + if(pageflipflop){ if(id==0) - mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tilesw, mv[0].ty-1, x, player, mv->page->dx); + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); - //} + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); + }else mapDrawCol(&mv[(!mv[0].video->p)], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); } @@ -315,7 +389,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) { word x, y; /* coordinate for drawing */ - /* increment the pixel position and update the page */ + /* decrement the pixel position and update the page */ mv[id].page->dx -= player[plid].speed; /* check to see if this changes the tile */ @@ -332,11 +406,12 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) /* draw the next column */ x= 0; if(player[plid].q%4) + if(pageflipflop){ if(id==0) mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); - //} + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); + }else mapDrawCol(&mv[(!mv[0].video->p)], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); } @@ -344,7 +419,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) { word x, y; /* coordinate for drawing */ - /* increment the pixel position and update the page */ + /* decrement the pixel position and update the page */ mv[id].page->dy -= player[plid].speed; /* check to see if this changes the tile */ @@ -360,11 +435,12 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) /* draw the next row */ y= 0; if(player[plid].q%3) + if(pageflipflop){ if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); - //} + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); + }else mapDrawRow(&mv[(!mv[0].video->p)], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); } void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) @@ -387,11 +463,74 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) /* draw the next row */ y= mv[0].page->sh + mv[id].map->tiles->tileHeight; if(player[plid].q%3) + if(pageflipflop){ if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->tilesh, y, player, mv->page->dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); - //} + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); + }else mapDrawRow(&mv[(!mv[0].video->p)], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy); +} + + +//TODO finish this wwww +void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) +{ + /* increment the pixel position and update the page */ + mv[0].video->page[id].dx += player[plid].speed; + + /* check to see if this changes the tile */ + if(mv[0].video->page[id].dx >= mv[id].dxThresh ) + { + /* Snap the origin forward */ + mv[0].video->page[id].data += 4; + mv[0].video->page[id].dx = mv[0].map->tiles->tileWidth; + } +} + + +void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) +{ + /* decrement the pixel position and update the page */ + mv[0].video->page[id].dx -= player[plid].speed; + + /* check to see if this changes the tile */ + if(mv[0].video->page[id].dx == 0) + { + /* Snap the origin backward */ + mv[0].video->page[id].data -= 4; + mv[0].video->page[id].dx = mv[0].map->tiles->tileWidth; + } +} + +void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) +{ + /* decrement the pixel position and update the page */ + mv[0].video->page[id].dy -= player[plid].speed; + + /* check to see if this changes the tile */ + if(mv[0].video->page[id].dy == 0) + { + /* Snap the origin backward */ + mv[0].video->page[id].data -= 4; + mv[0].video->page[id].dy = mv[0].map->tiles->tileWidth; + } +} + +void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) +{ + /* increment the pixel position and update the page */ + mv[0].video->page[id].dy += player[plid].speed; + + /* check to see if this changes the tile */ + if(mv[0].video->page[id].dy >= mv[id].dxThresh ) + { + /* Snap the origin forward */ + mv[0].video->page[id].data += 4; + mv[0].video->page[id].dy = mv[0].map->tiles->tileWidth; + } +// modexClearRegion(&(mv[0].video->page[id]), 0, 0, +// mv[0].video->page[id].width-1, +// mv[0].video->page[id].height-1, id*2); } sword chkmap(map_t *map, word q) @@ -443,23 +582,24 @@ void mapGoTo(map_view_t *mv, int tx, int ty) unsigned int i; /* set up the coordinates */ - mv->tx = tx; - mv->ty = ty; - mv->page->dx = mv->map->tiles->tileWidth; - mv->page->dy = mv->map->tiles->tileHeight; + mv[0].tx = mv[1].tx = tx; + mv[0].ty = mv[1].ty = ty; + mv[0].page->dx = mv[1].page->dx = mv->map->tiles->tileWidth; + mv[0].page->dy = mv[1].page->dy = mv->map->tiles->tileHeight; /* set up the thresholds */ - mv->dxThresh = mv->map->tiles->tileWidth * 2; - mv->dyThresh = mv->map->tiles->tileHeight * 2; + mv[0].dxThresh = mv[1].dxThresh = mv->map->tiles->tileWidth * 2; + mv[0].dyThresh = mv[1].dyThresh = mv->map->tiles->tileHeight * 2; /* draw the tiles */ - modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); + modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0); py=0; - i=mv->ty * mv->map->width + mv->tx; - for(ty=mv->ty-1; py < mv->page->sh+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { - mapDrawWRow(mv, tx-1, ty, py); + i=mv[0].ty * mv[0].map->width + mv[0].tx; + for(ty=mv[0].ty-1; py < mv[0].page->sh+mv->dyThresh && ty < mv[0].map->height; ty++, py+=mv[0].map->tiles->tileHeight) { + mapDrawWRow(&mv[0], tx-1, ty, py); i+=mv->map->width - tx; } + modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); } @@ -486,7 +626,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) case 0: #ifndef TILERENDER modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)); - //cannot print number value du to it being slow as bakapee + modexprint(page, x, y, 1, 15, 0, (char const *)(t->debug_data[i])); #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) */ @@ -586,35 +726,51 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) //setkb(0); }*/ -unsigned char shinku_fps_indicator_page = 0; +unsigned char shinku_fps_indicator_page = 2; +boolean pageflipflop=0; +//gv->video.p /* sync */ void shinku(global_game_variables_t *gv) { + word x = (0) + gv->video.page[!(gv->video.p)].dx; // follow the screen + word y = (0) + gv->video.page[!(gv->video.p)].dy; // follow the screen + word w = 64; + word h = 8; + word col = 7; + word bgcol = 0; + word type = 1; + byte o,o2,i; //modexCopyPageRegion(pip[1].page, pip[2].page, 16, 16, 16, 16, (14*8)+4, 8+4); + /* block copy to visible RAM from offscreen */ +// vga_setup_wm1_block_copy(); +// modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x+w, 0, w, h); +// o = *(gv->video.page[2].data); // source offscreen +// o2 = *(gv->video.page[shinku_fps_indicator_page].data)+(y * vga_state.vga_stride) + (x >> 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(); if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) { - word x = (16) + gv->video.page[shinku_fps_indicator_page].dx; // follow the screen - word y = (16) + gv->video.page[shinku_fps_indicator_page].dy; // follow the screen - word col = 7; - word bgcol = 0; - word type = 0; - - //t=(((*(gv->clock))-gv->clock_start) /18.2); - sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); -// printf("%s\n", gv->pee); - //FIXME PLEASE!! - modexprint(&(gv->video.page[shinku_fps_indicator_page]), x, y, type, col, bgcol, gv->pee); -//++++ modexprint(&(gv->video.page[0]), x, y, type, col, bgcol, gv->pee); - //(gv->clock_start)=*(gv->clock); + sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv)); + //modexClearRegion(&(gv->video.page[shinku_fps_indicator_page]), x, y, w, h, 45); + modexprint(&(gv->video.page[!(gv->video.p)]), x, y, type, col, bgcol, gv->pee); gv->kurokku.tiku=0; - } - //modexprint(page, 16, 16, 1, 15, 0, pee); + /* block copy to visible RAM from offscreen */ +// vga_setup_wm1_block_copy(); +// o = *(gv->video.page[shinku_fps_indicator_page].data); // source offscreen +// o2 = *(gv->video.page[2].data)+(y * vga_state.vga_stride) + (x >> 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); +// modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x, 0, w, h); + /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ +// vga_restore_rm0wm0(); + }else //copy dat sheet gv->kurokku.tiku++; + switch(gv->kurokku.fpscap) { case 0: - //modexprint(page, 16, 32, 1, 15, 0, "sanic!"); + modexprint(&(gv->video.page[shinku_fps_indicator_page]), x, y+8, type, col, bgcol, "sanic!"); gv->kurokku.frames_per_second=1; break; case 1: @@ -624,6 +780,14 @@ void shinku(global_game_variables_t *gv) gv->kurokku.frames_per_second=60; break; } + if(pageflipflop){ + if(gv->video.r){ + modexCopyPageRegion(&(gv->video.page[(gv->video.p)]), &(gv->video.page[(!gv->video.p)]), 0, 0, 0, 0, gv->video.page[gv->video.p].width, gv->video.page[!gv->video.p].height); + modexShowPage(&(gv->video.page[gv->video.p])); //this is slow as fack too!! + gv->video.p=!gv->video.p; + gv->video.r=!gv->video.r; + } + } } void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch) @@ -673,22 +837,27 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll // #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); -#define FRAME4 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); +#define FRAME1 PBUFSFUN(pip[!(pip->video->p)].page, x, y, 48, dire, 24, 32, PLAYERBMPDATA); +#define FRAME2 PBUFSFUN(pip[!(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); +#define FRAME3 PBUFSFUN(pip[!(pip->video->p)].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA); +#define FRAME4 PBUFSFUN(pip[!(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA); #else -#define FRAME1 modexClearRegion(pip[1].page, x, y, 24, 32, 2+dire); -#define FRAME2 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire); -#define FRAME3 modexClearRegion(pip[1].page, x, y, 24, 32, dire); -#define FRAME4 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire); -#endif - modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40); +#define FRAME1 modexClearRegion(pip[!(pip->video->p)].page, x, y, 24, 32, 2+dire); +#define FRAME2 modexClearRegion(pip[!(pip->video->p)].page, x, y, 24, 32, 1+dire); +#define FRAME3 modexClearRegion(pip[!(pip->video->p)].page, x, y, 24, 32, dire); +#define FRAME4 modexClearRegion(pip[!(pip->video->p)].page, x, y, 24, 32, 1+dire); + #endif +// if(pageflipflop) +//modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); + modexCopyPageRegion(pip[pip->video->p].page, + pip[!(pip->video->p)].page, x-4, y-4, x-4, y-4, 28, 36); +// else modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40); //modexCopyPageRegion(pip[2].page, pip[1].page, 16, 16, 16, 16, (14*8)+4, 8+4); if(2>ls && ls>=1) { FRAME1 }else if(3>ls && ls>=2) { FRAME2 }else if(4>ls && ls>=3) { FRAME3 }else if(5>ls && ls>=4) { FRAME4 } + pip->video->r=1; //TODO: mask copy //modexCopyPageRegion(dest->page, src->page, x-4, y-4, x-4, y-4, 28, 40); //modexClearRegion(top->page, 66, 66, 2, 40, 0); //modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40); diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index d3711b5e..30bfc1ab 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -29,7 +29,7 @@ #include "src/lib/16_in.h" #include "src/lib/bitmap.h" #include "src/lib/planar.h" -#include "src/lib/mapread.h" +#include "src/lib/mapread.h" //map is loaded here www #include "src/lib/16_timer.h" #include "src/lib/wcpu/wcpu.h" @@ -52,6 +52,8 @@ typedef struct { int ty; //appears to be the top left tile position on the viewable screen map word dxThresh; //???? word dyThresh; //???? + video_t *video; //pointer to game variables of the video + pan_t *pan; //pointer the the page panning debug system } map_view_t; typedef struct @@ -63,13 +65,20 @@ typedef struct #define MAPW 40 #define MAPH 30 +extern boolean pageflipflop; + //map_t allocMap(int w, int h); //void initMap(map_t *map); void walk(map_view_t *pip, player_t *player, word pn); +void panpagemanual(map_view_t *pip, player_t *player, word pn); void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid); +void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid); +void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid); +void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid); +void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid); sword chkmap(map_t *map, word q); void mapGoTo(map_view_t *mv, int tx, int ty); void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y); diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 772f3066..0f47b2b1 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -36,6 +36,8 @@ #define AAMAGENTA "\x1b[45;35m" #define AARESET "\x1b[0m" +#define MAXPAGE 4 + /* * typedefs of the game variables! */ @@ -70,16 +72,18 @@ typedef struct { word dy; /* row we are viewing on the virtual screen */ word sw; /* screen width */ word sh; /* screen heigth */ - word tilesw; /* screen width in tiles */ - word tilesh; /* screen height in tiles */ + word tw; /* screen width in tiles */ + word th; /* screen height in tiles */ word width; /* virtual width of the page */ word height; /* virtual height of the page */ - word tw; - word th; + word tilesw; /* virtual screen width in tiles */ + word tilesh; /* virtual screen height in tiles */ sword tilemidposscreenx; /* middle tile position */ sword tilemidposscreeny; /* middle tile position */ sword tileplayerposscreenx; /* player position on screen */ sword tileplayerposscreeny; /* player position on screen */ + word stridew; /*width/4*/ + word pagesize; /* page size */ } page_t; typedef struct @@ -101,8 +105,18 @@ typedef struct typedef struct { - long old_mode; //old video mode before game! - page_t page[4]; //pointer to root page[0] + word pn; +} pan_t; + +typedef struct +{ + char old_mode; //old video mode before game! + page_t page[MAXPAGE]; //pointer to root page[0] + word vmem_remain; //remaining video memory + byte num_of_pages; //number of actual pages + boolean __near p; //render page number + boolean __near r; //page flip if true + word pr[MAXPAGE][4]; //render sections of pages } video_t; typedef struct diff --git a/src/lib/types.h b/src/lib/types.h index c01eeef3..69291248 100755 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -37,6 +37,9 @@ typedef signed long sdword; typedef unsigned int iword; typedef signed int siword; +typedef unsigned long int diword; +typedef signed long int sdiword; + typedef enum {false,true} boolean; #endif/*_TYPE_H_*/ diff --git a/src/scroll.c b/src/scroll.c index d13d7d01..b108a20d 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -33,15 +33,16 @@ global_game_variables_t gvar; 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 mv[4]; bitmap_t p; -word pn=0; +//word pn=0; //i forgot ww static planar_buf_t huge *pp; float t; sword bakapee; - -// word panswitch=0, panq=1, pand=0; - word panpagenum=0; //for panning! +pan_t pan; +//debugswitches +boolean panswitch=0; +boolean pageflipflop=1; unsigned int i; const char *cpus; //static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ @@ -84,8 +85,14 @@ void main(int argc, char *argv[]) return; } - player[0].persist_aniframe=0; - player[0].speed=4; + 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 + + pan.pn=1; //player[0].data = &pp; printf("starting timer "); @@ -100,9 +107,6 @@ void main(int argc, char *argv[]) chkmap(&map, 0); printf("chkmap ok "); fprintf(stderr, "yay map loaded~~\n"); - mv[0].map = ↦ - mv[1].map = ↦ - mv[2].map = ↦ /* draw the tiles */ #ifdef MODEX @@ -123,6 +127,7 @@ void main(int argc, char *argv[]) /* input! */ IN_Startup(); IN_Default(0,&player,ctrl_Joystick); + //IN_Default(1,&player,ctrl_Joystick); /* save the palette */ #ifdef MODEX @@ -163,29 +168,26 @@ void main(int argc, char *argv[]) #endif /* 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); - mv[0].page = &gvar.video.page[0]; - gvar.video.page[1] = modexNextPage(mv[0].page); - mv[1].page = &gvar.video.page[1]; - - gvar.video.page[2] = modexNextPageFlexibleSize(mv[1].page, gvar.video.page[0].sw, gvar.video.page[0].sh); //(352*176)+1024 is the remaining amount of memory left wwww - //gvar.video.page[2] = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww - mv[2].page = &gvar.video.page[2]; - + modexHiganbanaPageSetup(&gvar.video); + for(i=0;iwidth, mv[1].page->height); + //TODO: put player in starting position of spot //default player position on the viewable map player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx; player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny; IN_initplayer(&player, 0); + //IN_initplayer(&player, 1); - 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 @@ -193,8 +195,9 @@ void main(int argc, char *argv[]) PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp); #endif - modexShowPage(mv[1].page); - shinku_fps_indicator_page = 1; // we're on page 1 now, shinku(). follow along please or it will not be visible. + if(!pageflipflop) modexShowPage(mv[1].page); + else modexShowPage(mv[(gvar.video.p)].page); + shinku_fps_indicator_page = 1; // we're on page 1 now, shinku(). follow along please or it will not be visible. //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1); #ifdef MODEX #ifdef FADE @@ -204,129 +207,21 @@ void main(int argc, char *argv[]) while(!IN_KeyDown(sc_Escape) && player[0].hp>0) { shinku(&gvar); - IN_ReadControl(0,&player); //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction //when player[0].tx or player[0].ty == 0 or player[0].tx == 20 or player[0].ty == 15 then stop because that is edge of map and you do not want to walk of the map //player movement - //if(!panswitch){ + IN_ReadControl(0,&player); + if(!panswitch){ walk(mv, player, 0); - /*}else{ -//88 switch! - //right movement - if((IN_KeyDown(77) && !IN_KeyDown(75) && pand == 0) || pand == 2) - { - if(pand == 0){ pand = 2; } - if(panq<=(TILEWH/(player[0].speed))) - { - switch(panpagenum) - { - case 0: - //bg - mv[0].page->dx++; - modexShowPage(mv[0].page); - break; - case 1: - //spri - mv[1].page->dx++; - modexShowPage(mv[1].page); - break; - case 2: - //fg - mv[2].page->dx++; - modexShowPage(mv[2].page); - break; - } - panq++; - } else { panq = 1; pand = 0; } + }else{ + panpagemanual(mv, player, 0); + //printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d); } - //left movement - if((IN_KeyDown(75) && !IN_KeyDown(77) && pand == 0) || pand == 4) - { - if(pand == 0){ pand = 4; } - if(panq<=(TILEWH/(player[0].speed))) - { - switch(panpagenum) - { - case 0: - //bg - mv[0].page->dx--; - modexShowPage(mv[0].page); - break; - case 1: - //spri - mv[1].page->dx--; - modexShowPage(mv[1].page); - break; - case 2: - //fg - mv[2].page->dx--; - modexShowPage(mv[2].page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } - //down movement - if((IN_KeyDown(72) && !IN_KeyDown(80) && pand == 0) || pand == 3) - { - if(pand == 0){ pand = 3; } - if(panq<=(TILEWH/(player[0].speed))) - { - switch(panpagenum) - { - case 0: - //bg - mv[0].page->dy--; - modexShowPage(mv[0].page); - break; - case 1: - //spri - mv[1].page->dy--; - modexShowPage(mv[1].page); - break; - case 2: - //fg - mv[2].page->dy--; - modexShowPage(mv[2].page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } - //up movement - if((IN_KeyDown(80) && !IN_KeyDown(72) && pand == 0) || pand == 1) - { - if(pand == 0){ pand = 1; } - if(panq<=(TILEWH/(player[0].speed))) - { - switch(panpagenum) - { - case 0: - //bg - mv[0].page->dy++; - modexShowPage(mv[0].page); - break; - case 1: - //spri - mv[1].page->dy++; - modexShowPage(mv[1].page); - break; - case 2: - //fg - mv[2].page->dy++; - modexShowPage(mv[2].page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } -}*/ - //the scripting stuf.... - + //the scripting stuff.... //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && 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)) { @@ -339,11 +234,13 @@ 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(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 + if(IN_KeyDown(2)){ modexShowPage(mv[0].page); pan.pn=0; } + if(IN_KeyDown(3)){ modexShowPage(mv[1].page); pan.pn=1; } + if(IN_KeyDown(4)){ modexShowPage(mv[2].page); pan.pn=2; } + if(IN_KeyDown(4+1)){ modexShowPage(mv[3].page); pan.pn=3; } + if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); + //IN_Ack(); + } //p #ifdef MODEX #ifdef FADE if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); } @@ -356,38 +253,32 @@ void main(int argc, char *argv[]) #endif #endif //pan switch - //if(IN_KeyDown(88)){if(!panswitch) panswitch++; else panswitch--; } //f12 + if(IN_KeyDown(88)){panswitch=!panswitch;} //f12 //TSR if(IN_KeyDown(87)) //f11 { - VGAmodeX(0, 0, &gvar); - IN_Shutdown(); - __asm - { - mov ah,31h - int 21h - } + pageflipflop=!pageflipflop; + //IN_Ack(); +// VGAmodeX(0, 0, &gvar); +// IN_Shutdown(); +// __asm +// { +// mov ah,31h +// int 21h +// } } - if(IN_KeyDown(88)) //s + if(IN_KeyDown(68)) //s { - switch(gvar.kurokku.fpscap) - { - case 0: - gvar.kurokku.fpscap=1; - break; - case 1: - gvar.kurokku.fpscap=0; - break; - } - IN_Ack(); + gvar.kurokku.fpscap=!gvar.kurokku.fpscap; + //IN_Ack(); } //TODO fmemtest into page - if(IN_KeyDown(4+1)) //4 + /*if(IN_KeyDown(4+1)) //4 { pg=1; SELECT_ALL_PLANES(); _fmemset(((mv[pg].page->data+4)+(16*(mv[pg].page->width/4))), 15, 4); - } + }*/ //9 if(IN_KeyDown(10)){ modexPalOverscan(default_pal, rand()%56); modexPalUpdate1(default_pal); } @@ -410,12 +301,12 @@ void main(int argc, char *argv[]) printf("version %s\n", VERSION); 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); + printf("player.x: %d", player[0].x); printf(" player.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); - printf("player[0].tx: %d", player[0].tx); printf(" player[0].ty: %d\n", player[0].ty); - 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("player.tx: %d", player[0].tx); printf(" player.ty: %d\n", player[0].ty); + printf("player.triggx: %d", player[0].triggerx); printf(" player.triggy: %d\n", player[0].triggery); + printf("player.hp: %d", (player[0].hp)); printf(" player.q: %d", player[0].q); printf(" player.info.dir: %d", player[0].info.dir); printf(" player.d: %d ", player[0].d); printf("pdir=%d\n", player[0].pdir); 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); @@ -425,15 +316,16 @@ void main(int argc, char *argv[]) //not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d\n", gvar.video.page[0].height); printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh); - printf("tile resolution: %dx", gvar.video.page[0].tilesh); printf("%d\n", gvar.video.page[0].tilesh); + printf("virtual tile resolution: %dx", gvar.video.page[0].tilesw); printf("%d\n", gvar.video.page[0].tilesh); + printf("tile resolution: %dx", gvar.video.page[0].tw); printf("%d \n", gvar.video.page[0].th); printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx); printf("%d\n", gvar.video.page[0].tilemidposscreeny); -// printf("Screen2: %dx", gvar.video.page[1].width); printf("%d\n", gvar.video.page[1].height); -// printf("map: %dx%d\n", map.width, map.height); -// 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); + modexprintmeminfo(&gvar.video); + printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf(" mv[%u].ty: %d ", pan.pn, mv[pan.pn].ty); printf("gvar.video.p=%u\n", gvar.video.p); + //printf("player[1].q: %d", player[1].q); printf(" player[1].d: %d\n", player[1].d); + printf("\n"); //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]); + printf("\n"); switch(detectcpu()) { case 0: cpus = "8086/8088 or 186/88"; break; diff --git a/src/test.c b/src/test.c index b80291fc..2c698a63 100755 --- a/src/test.c +++ b/src/test.c @@ -23,15 +23,18 @@ #include #include "src/lib/modex16.h" #include "src/lib/16_in.h" +#include "src/lib/scroll16.h" global_game_variables_t gvar; player_t player[MaxPlayers]; +map_view_t mv[4]; +pan_t pan; void main(int argc, char *argv[]) { int i, j; - word start, end; - word p, k; + word startclk, endclk; + word k; byte *pal, *pal2; sword bakapee; @@ -39,6 +42,35 @@ void main(int argc, char *argv[]) if(argv[1]) bakapee = atoi(argv[1]); else bakapee = 1; + + // 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 + /* load our palette */ modexLoadPalFile("data/default.pal", &pal2); @@ -48,74 +80,117 @@ void main(int argc, char *argv[]) modexFadeOff(1, pal); modexPalBlack(); + IN_Startup(); + IN_Default(0,&player,ctrl_Keyboard1); + IN_initplayer(&player, 0); + + textInit(); VGAmodeX(bakapee, 1, &gvar); modexPalBlack(); - IN_Startup(); - IN_Default(0,&player,ctrl_Joystick); - /* set up the page, but with 16 pixels on all borders in offscreen mem */ - gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); - gvar.video.page[1] = modexNextPage(&gvar.video.page[0]); - gvar.video.page[0].width += 32; - gvar.video.page[0].height += 32; + modexHiganbanaPageSetup(&gvar.video); + for(i=0;i=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[p].dx--; + // go left + gvar.video.page[pan.pn].dx--; if(j>=32){ k++; j=0; }else j++; break; case 2: - /* go up */ - gvar.video.page[p].dy++; + // go up + gvar.video.page[pan.pn].dy++; if(j>=32){ k++; j=0; }else j++; break; case 3: - /* go down */ - gvar.video.page[p].dy--; + // go down + gvar.video.page[pan.pn].dy--; if(j>=32){ k=0; j=0; i++; }else j++; break; default: break; - } - if(IN_KeyDown(2)) p=0; - if(IN_KeyDown(3)) p=1; - modexShowPage(&gvar.video.page[p]); + }}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); +// } + //} + if(IN_KeyDown(1+1)) pan.pn=0; + if(IN_KeyDown(2+1)) pan.pn=1; + if(IN_KeyDown(3+1)) pan.pn=2; + if(IN_KeyDown(4+1)) pan.pn=3; + if(IN_KeyDown(25)){ + modexpdump(&gvar.video.page[pan.pn]); + }//p + modexShowPage(&gvar.video.page[pan.pn]); } - end = *clockw; + endclk = *clockw; /* fade back to text mode */ modexFadeOff(1, pal2); modexPalBlack(); VGAmodeX(0, 1, &gvar); - IN_Shutdown(); printf("Project 16 test.exe. This is just a test file!\n"); printf("version %s\n", VERSION); + modexprintmeminfo(&gvar.video); + printf("tx=%d ", mv[pan.pn].tx); printf("ty=%d ", mv[pan.pn].ty); printf("player.d=%d\n", player[0].d); + IN_Shutdown(); modexPalBlack(); modexFadeOn(1, pal); } diff --git a/src/test0.c b/src/test0.c new file mode 100755 index 00000000..35d2c8d2 --- /dev/null +++ b/src/test0.c @@ -0,0 +1,37 @@ +#include +#include + +void baka(unsigned far *z) +{ + unsigned w; +// w = _nmalloc(sizeof(unsigned)); + z=(&w); + for(w=0; w<16;w++) + { + printf("z=(%Fp)%u w=(%Fp)%u\n", z, *z, &w, w); + } + printf("\n"); +} + +void pee(unsigned far *z) +{ + unsigned near *w; + w = _nmalloc(sizeof(unsigned)); + z=(w); + for((*w)=0;(*w)<16;(*w)++) + { + printf("z=(%Fp)%u w=(%Fp)%u\n", z, *z, w, *w); + } + printf("\n"); +} + +void main() +{ + unsigned near w; + unsigned far *z; + baka(z); + pee(z); + printf("&w=%Fp\n", &w); + printf("&z=%Fp\n", &z); + printf("*z=%Fp\n", *z); +} diff --git a/src/tesuto.c b/src/tesuto.c index 903dd6af..83f3712e 100755 --- a/src/tesuto.c +++ b/src/tesuto.c @@ -53,7 +53,7 @@ int main(int argc,char **argv) { vga_state.vga_width = 320; // VGA lib currently does not update this vga_state.vga_height = 240; // 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 +#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case { struct vga_mode_params cm; @@ -70,7 +70,7 @@ int main(int argc,char **argv) { vga_write_crtc_mode(&cm,0); } vga_state.vga_height = 240; // VGA lib currently does not update this -//#endif +#endif /* load color palette */ fd = open(argv[2],O_RDONLY|O_BINARY); @@ -99,7 +99,7 @@ int main(int argc,char **argv) { vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! } } - while (getch() != 13); + //while (getch() != 13); /* make distinctive pattern offscreen, render sprite, copy onscreen */ { @@ -342,4 +342,3 @@ int main(int argc,char **argv) { bufsz = 0; return 0; } - diff --git a/test.smp b/test.smp new file mode 100755 index 00000000..7ac5708d Binary files /dev/null and b/test.smp differ diff --git a/videolay.txt b/videolay.txt new file mode 100755 index 00000000..d6167ff0 --- /dev/null +++ b/videolay.txt @@ -0,0 +1,52 @@ +ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ÄÄÄ +º ³//ÀÄÄÄÄÄÄÄĺ ³ +ºÄÄÙ///////////º ³ +º/////ÚÄÄÄÄÄÄÄĺ ³ +ºÄÄ¿//³PAGE 0 º ³ +º ³//³ (Draw) º ³ +º ³//ÀÄÄÄÄÄÄÄĺ ³ +ºÄÄÙ///////////º 64K +º/////ÚÄÄÄÄÄÄÄĺ (21K each page) +ºÄÄ¿//³PAGE 1 º ³ +º ³//³ (Show) º ³ +º ³//ÀÄÄÄÄÄÄÄĺ ³ +ºÄÄÙ///////////º ³ +º/////ÚÄÄÄÄÄÄÄĺ ³ +ºÄÄ¿//³PAGE 2 º ³ +º ³//³ (Blank)º ³ +ÈÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ÄÄÄ + +playerspritesheet +72*128 +ÉÍÍÍË +º012º +º345º +º678º +º9abº +ÌÍÍÍÎ +background cache 72*80 +sprite area seems to be 28*36 each +ÌÍÍÍÍÎ +º01³-º +º23³-º +ºÄÄÙ-º +º----º +ÈÍÍÍÍÊ +remaining area is 16*80+72*8 +this i think can be used for sprite buffering of masking stuff +specifically the 16*80 +which gived us 5 tiles of space wwww + + +248*208 free mem on page left ^^; +planned layout~ +ÉÍÍÍË +º012º +º345º +º678º +º9abº +ÌÍÍÍÎ +º01-º +º23-º +º---º +ÈÍÍÍÊ