From 5991a0522a36b2a73bc223c50113965179a53b7a Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sat, 15 Apr 2017 11:35:41 -0500 Subject: [PATCH] p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I should remember what needs to be done soon][OpenVGMFile needs to be ported to 16_snd.c]going to port rest of code to borland c some time so we can use the core components of id engine here [going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] MM_ShowMemory is quite buggy on real machines. i need to debug it and fix added a struct printer[gvar.mm is FUCKING HUGE 14402 bytes FAT\!]16_rf now compiles BT UNKNOWN ON WHAT IT DOSE\! text box creates a ghost because page 1 do not have bg info thus it is stored and saved.... wwww fizzfade being worked on and no idea how to make it work...[xcroll is fixed resuming fizzfade testings] also imf to xcroll is not work [did some testing wwww and added 0croll.c the original one and it do not work.. damn it\!] --- 16/src/lib/bitmap.c | 15 +- 16/src/lib/bitmap.h | 4 +- 16/src/lib/omodex16.c | 640 ++++++++++++++++++++++++++++++++++++++++++ 16/src/lib/omodex16.h | 87 ++++++ makefile | 3 +- src/0croll.c | 36 +-- src/inputest.c | 5 +- src/lib/16_dbg.h | 2 +- src/lib/16render.c | 4 +- src/lib/16render.h | 3 +- src/vrstest.c | 4 + 11 files changed, 763 insertions(+), 40 deletions(-) create mode 100755 16/src/lib/omodex16.c create mode 100755 16/src/lib/omodex16.h diff --git a/16/src/lib/bitmap.c b/16/src/lib/bitmap.c index 6e496049..4e48cab2 100755 --- a/16/src/lib/bitmap.c +++ b/16/src/lib/bitmap.c @@ -77,7 +77,7 @@ static void loadPcxPalette(FILE *file, bitmap_t *result) { /* handle the palette */ fseek(file, -769, SEEK_END); val = fgetc(file); - result->palette = modexNewPal(); + result->palette = omodexNewPal(); if(head.version == 5 && val == 12) { /* use the vga palette */ for(index=0; !feof(file) && index < PAL_SIZE; index++) { @@ -197,16 +197,3 @@ bitmapLoadPcxTiles(char *filename, word twidth, word theight) { return ts; } - -byte * -modexNewPal() { - byte *ptr; - ptr = malloc(PAL_SIZE); - - // handle errors - if(!ptr) { - printf("Could not allocate palette.\n"); - } - - return ptr; -} diff --git a/16/src/lib/bitmap.h b/16/src/lib/bitmap.h index d87356b2..22007989 100755 --- a/16/src/lib/bitmap.h +++ b/16/src/lib/bitmap.h @@ -26,9 +26,9 @@ #ifndef BITMAP_H #define BITMAP_H -#include "src/lib/16_vl.h" +#include "16/src/lib/omodex16.h" bitmap_t bitmapLoadPcx(char *filename, global_game_variables_t *gv); tileset_t bitmapLoadPcxTiles(char *filename, word twidth, word theight); -byte *modexNewPal(); + #endif diff --git a/16/src/lib/omodex16.c b/16/src/lib/omodex16.c new file mode 100755 index 00000000..4a3942be --- /dev/null +++ b/16/src/lib/omodex16.c @@ -0,0 +1,640 @@ +#include +#include +#include +#include +#include +#include +#include "16/src/lib/omodex16.h" + + +byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ + +static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette); +static byte tmppal[PAL_SIZE]; + +static void +vgaSetMode(byte mode) +{ + union REGS regs; + + regs.h.ah = SET_MODE; + regs.h.al = mode; + int86(VIDEO_INT, ®s, ®s); +} + + +/* -========================= Entry Points ==========================- */ +void +omodexEnter() { + word i; + dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ + word CRTParms[] = { + 0x0d06, /* vertical total */ + 0x3e07, /* overflow (bit 8 of vertical counts) */ + 0x4109, /* cell height (2 to double-scan */ + 0xea10, /* v sync start */ + 0xac11, /* v sync end and protect cr0-cr7 */ + 0xdf12, /* vertical displayed */ + 0x0014, /* turn off dword mode */ + 0xe715, /* v blank start */ + 0x0616, /* v blank end */ + 0xe317 /* turn on byte mode */ + }; + int CRTParmCount = sizeof(CRTParms) / sizeof(CRTParms[0]); + + /* TODO save current video mode and palette */ + vgaSetMode(VGA_256_COLOR_MODE); + + /* disable chain4 mode */ + outpw(SC_INDEX, 0x0604); + + /* synchronous reset while setting Misc Output */ + outpw(SC_INDEX, 0x0100); + + /* select 25 MHz dot clock & 60 Hz scanning rate */ + outp(MISC_OUTPUT, 0xe3); + + /* undo reset (restart sequencer) */ + outpw(SC_INDEX, 0x0300); + + /* 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 */ + + /* send the CRTParms */ + for(i=0; idata + (p->width/4)*p->height; /* compute the offset */ + result.dx = 0; + result.dy = 0; + result.width = p->width; + result.height = p->height; + + return result; +} + + +void +omodexShowPage(opage_t *page) { + word high_address; + word low_address; + word offset; + byte crtcOffset; + + /* calculate offset */ + offset = (word) page->data; + offset += page->dy * (page->width >> 2 ); + offset += page->dx >> 2; + + /* calculate crtcOffset according to virtual width */ + crtcOffset = page->width >> 3; + + high_address = HIGH_ADDRESS | (offset & 0xff00); + low_address = LOW_ADDRESS | (offset << 8); + + /* wait for appropriate timing and then program CRTC */ + while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE)); + outpw(CRTC_INDEX, high_address); + outpw(CRTC_INDEX, low_address); + outp(CRTC_INDEX, 0x13); + outp(CRTC_DATA, crtcOffset); + + /* wait for one retrace */ + while (!(inp(INPUT_STATUS_1) & VRETRACE)); + + /* do PEL panning here */ + outp(AC_INDEX, 0x33); + outp(AC_INDEX, (page->dx & 0x03) << 1); +} + + +void +omodexPanPage(opage_t *page, int dx, int dy) { + page->dx = dx; + page->dy = dy; +} + + +void +omodexSelectPlane(byte plane) { + outp(SC_INDEX, MAP_MASK); /* select plane */ + outp(SC_DATA, plane); +} + + +void +omodexClearRegion(opage_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 */ + byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ + byte rclip[] = {0x00, 0x01, 0x03, 0x07}; + byte left = lclip[x&0x03]; + byte right = rclip[(x+w)&0x03]; + + /* handle the case which requires an extra group */ + if((x & 0x03) && !((x+w) & 0x03)) { + right=0x0f; + } + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + MOV DI, poffset ; go to the first pixel + MOV DX, SC_INDEX ; point to the map mask + MOV AL, MAP_MASK + OUT DX, AL + INC DX + MOV AL, color ; get ready to write colors + SCAN_START: + MOV CX, scanCount ; count the line + MOV BL, AL ; remember color + MOV AL, left ; do the left clip + OUT DX, AL ; set the left clip + MOV AL, BL ; restore color + STOSB ; write the color + DEC CX + JZ SCAN_DONE ; handle 1 group stuff + + ;-- write the main body of the scanline + MOV BL, AL ; remember color + MOV AL, 0x0f ; write to all pixels + OUT DX, AL + MOV AL, BL ; restore color + REP STOSB ; write the color + SCAN_DONE: + MOV BL, AL ; remeber color + MOV AL, right + OUT DX, AL ; do the right clip + MOV AL, BL ; restore color + STOSB ; write pixel + ADD DI, nextRow ; go to the next row + DEC h + JNZ SCAN_START + } +} + + +void +omodexDrawBmp(opage_t *page, int x, int y, bitmap_t *bmp) { + /* draw the region (the entire freakin bitmap) */ + omodexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + + +void +omodexDrawBmpRegion(opage_t *page, int x, int y, + int rx, int ry, int rw, int rh, bitmap_t *bmp) { + word poffset = (word) page->data + y*(page->width/4) + x/4; + byte *data = bmp->data; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter=0; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + MOVSB ; copy the pixel + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + + +void +omodexDrawSprite(opage_t *page, int x, int y, bitmap_t *bmp) { + /* draw the whole sprite */ + omodexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +omodexDrawSpriteRegion(opage_t *page, int x, int y, + int rx, int ry, int rw, int rh, bitmap_t *bmp) { + word poffset = (word)page->data + y*(page->width/4) + x/4; + byte *data = bmp->data; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter=0; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: + MOVSB ; copy the pixel + NEXT_PIXEL: + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + + +/* copy a region of video memory from one page to another. + * It assumes that the left edge of the tile is the same on both + * regions and the memory areas do not overlap. + */ +void +omodexCopyPageRegion(opage_t *dest, opage_t *src, + word sx, word sy, + 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; + 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 { + MOV AX, SCREEN_SEG ; work in the vga space + MOV ES, AX ; + MOV DI, doffset ; + MOV SI, soffset ; + + MOV DX, GC_INDEX ; turn off cpu bits + MOV AX, 0008h ; + OUT DX, AX + + MOV AX, SC_INDEX ; point to the mask register + MOV DX, AX ; + MOV AL, MAP_MASK ; + OUT DX, AL ; + INC DX ; + + ROW_START: + PUSH DS + MOV AX, ES + MOV DS, AX + MOV CX, scans ; the number of latches + + MOV AL, left ; do the left column + OUT DX, AL ; + MOVSB ; + DEC CX ; + + MOV AL, 0fh ; do the inner columns + OUT DX, AL + REP MOVSB ; copy the pixels + + MOV AL, right ; do the right column + OUT DX, AL + MOVSB + POP DS + + MOV AX, SI ; go the start of the next row + ADD AX, nextSrcRow ; + MOV SI, AX ; + MOV AX, DI ; + ADD AX, nextDestRow ; + MOV DI, AX ; + + DEC height ; do the rest of the actions + JNZ ROW_START ; + + MOV DX, GC_INDEX+1 ; go back to CPU data + MOV AL, 0ffh ; none from latches + OUT DX, AL ; + } +} + + +/* fade and flash */ +void +omodexFadeOn(word fade, byte *palette) { + fadePalette(-fade, 64, 64/fade+1, palette); +} + + +void +omodexFadeOff(word fade, byte *palette) { + fadePalette(fade, 0, 64/fade+1, palette); +} + + +void +omodexFlashOn(word fade, byte *palette) { + fadePalette(fade, -64, 64/fade+1, palette); +} + + +void +omodexFlashOff(word fade, byte *palette) { + fadePalette(-fade, 0, 64/fade+1, palette); +} + + +static void +fadePalette(sbyte fade, sbyte start, word iter, byte *palette) { + word i; + byte dim = start; + + /* handle the case where we just update */ + if(iter == 0) { + omodexPalUpdate(palette); + return; + } + + while(iter > 0) { /* FadeLoop */ + for(i=0; i 127) { + tmppal[i] = 0; + } else if(tmppal[i] > 63) { + tmppal[i] = 63; + } + } + omodexPalUpdate(tmppal); + iter--; + dim += fade; + } +} + + +/* save and load */ +void +omodexPalSave(byte *palette) { + int i; + + outp(PAL_READ_REG, 0); /* start at palette entry 0 */ + for(i=0; i +#include "src/lib/16_head.h" +#include "16/src/lib/bitmap.h" + +/* -========================== Types & Macros ==========================- */ +#define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2)) +//#define PLANE(x) (1<< (x&3)) +#define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02) + +typedef struct { + byte far* data; /* the data for the page */ + word dx; /* col we are viewing on the virtual screen */ + word dy; /* row we are viewing on the virtual screen */ + word width; /* virtual width of the page */ + word height; /* virtual height of the page */ +} opage_t; + +/* -============================ Functions =============================- */ +/* mode switching, page, and plane functions */ +void omodexEnter(); +void omodexLeave(); +opage_t omodexDefaultPage(); +opage_t omodexNextPage(opage_t *p); +void omodexShowPage(opage_t *page); +void omodexPanPage(opage_t *page, int dx, int dy); +void omodexSelectPlane(byte plane); +void omodexClearRegion(opage_t *page, int x, int y, int w, int h, byte color); +void omodexDrawBmp(opage_t *page, int x, int y, bitmap_t *bmp); +void omodexDrawBmpRegion(opage_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); +void omodexDrawSprite(opage_t *page, int x, int y, bitmap_t *bmp); +void omodexDrawSpriteRegion(opage_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); + +/* Palette fade and flash effects */ +void omodexFadeOn(word fade, byte *palette); +void omodexFadeOff(word fade, byte *palette); +void omodexFlashOn(word fade, byte *palette); +void omodexFlashOff(word fade, byte *palette); + +/* palette loading and saving */ +void omodexPalSave(byte *palette); +byte *omodexNewPal(); +void omodexLoadPalFile(char *filename, byte **palette); +void omodexSavePalFile(char *filename, byte *palette); + +/* fixed palette functions */ +void omodexPalBlack(); +void omodexPalWhite(); + +/* utility functions */ +void omodexPalUpdate(byte *p); +void omodexWaitBorder(); +int US_CheckParm(char *parm,char **strings); + +/* -======================= 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 SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 +#define PAGE_SIZE (word)(SCREEN_WIDTH/4 * SCREEN_HEIGHT) + +#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 +#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/makefile b/makefile index 334e47f2..75fc0af8 100755 --- a/makefile +++ b/makefile @@ -256,7 +256,7 @@ bakapi.exe: bakapi.$(OBJ) 16_vl.$(OBJ) 16_vl_1.$(OBJ) 16text.$(OBJ) bakapee.$(O # # Test Executables! # -0croll.exe: 0croll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) $(OLDLIBOBJS) +0croll.exe: 0croll.$(OBJ) $(OLDLIBOBJS) omodex16.$(OBJ) 16_in.$(OBJ) 0croll.$(OBJ): $(SRC)/0croll.c scroll.exe: scroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) scroll.$(OBJ): $(SRC)/scroll.c @@ -385,6 +385,7 @@ bakapee.$(OBJ): $(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h 16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIB) 16_spri.$(OBJ):$(SRCLIB)/16_spri.c $(SRCLIB)/16_spri.h bitmap.$(OBJ): 16/$(SRCLIB)/bitmap.c 16/$(SRCLIB)/bitmap.h +omodex16.$(OBJ): 16/$(SRCLIB)/omodex16.c 16/$(SRCLIB)/omodex16.h planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h scroll16.$(OBJ):$(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h 16text.$(OBJ): $(SRCLIB)/16text.c $(SRCLIB)/16text.h diff --git a/src/0croll.c b/src/0croll.c index 844dc995..aabb518b 100755 --- a/src/0croll.c +++ b/src/0croll.c @@ -1,5 +1,5 @@ -//#include "modex16.h" -#include "src/lib/16_vl.h" +//from https://github.com/sparky4/16/commit/a19d7592507e5f7aa91f4a6b6611e021bd1a3e8d +#include "16/src/lib/omodex16.h" #include "16/src/lib/bitmap.h" #include #include @@ -29,7 +29,7 @@ typedef struct { typedef struct { omap_t *map; - page_t *page; + opage_t *page; int tx; //???? appears to be the tile position on the viewable screen map int ty; //???? appears to be the tile position on the viewable screen map word dxThresh; //???? @@ -49,7 +49,7 @@ void omapScrollLeft(omap_view_t *mv, byte offest); void omapScrollUp(omap_view_t *mv, byte offset); void omapScrollDown(omap_view_t *mv, byte offset); void omapGoTo(omap_view_t *mv, int tx, int ty); -void omapDrawTile(otiles_t *t, word i, page_t *page, word x, word y); +void omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y); void omapDrawRow(omap_view_t *mv, int tx, int ty, word y); void omapDrawCol(omap_view_t *mv, int tx, int ty, word x); @@ -62,7 +62,7 @@ void main() { //int ch=0x0; // byte ch; // int q=0; - page_t screen;//,screen2; + opage_t screen;//,screen2; omap_t map; omap_view_t mv;//, mv2; omap_view_t *draw;//, *show, *tmp; @@ -82,15 +82,15 @@ void main() { /* draw the tiles */ ptr = map.data; - modexEnter(1, 1, &gvar); - screen = modexDefaultPage(&screen, &gvar); + omodexEnter(1, 1, &gvar); + screen = omodexDefaultPage(); screen.width += (TILEWH*2); mv.page = &screen; omapGoTo(&mv, 16, 16); -// screen2=modexNextPage(mv.page); +// screen2=omodexNextPage(mv.page); // mv2.page = &screen2; // omapGoTo(&mv2, 16, 16); -// modexShowPage(mv.page); +// omodexShowPage(mv.page); /* set up paging */ // show = &mv; @@ -106,7 +106,7 @@ void main() { while(!gvar.in.inst->Keyboard[77]){ // for(q=0; qpage); +// omodexShowPage(draw->page); // omapScrollRight(draw, 1); // SWAP(draw, show); // } @@ -115,7 +115,7 @@ void main() { while(!gvar.in.inst->Keyboard[75]){ // for(q=0; qpage); +// omodexShowPage(draw->page); // omapScrollLeft(show, 1); // SWAP(draw, show); // } @@ -124,7 +124,7 @@ void main() { while(!gvar.in.inst->Keyboard[80]){ // for(q=0; qpage); +// omodexShowPage(draw->page); // omapScrollDown(show, 1); // SWAP(draw, show); // } @@ -133,18 +133,18 @@ void main() { while(!gvar.in.inst->Keyboard[72]){ // for(q=0; qpage); +// omodexShowPage(draw->page); // omapScrollUp(show, 1); // SWAP(draw, show); // } } //keyp(ch); - modexShowPage(draw->page); + omodexShowPage(draw->page); } - modexLeave(); + omodexLeave(); // setkb(0); IN_Shutdown(&gvar); @@ -312,7 +312,7 @@ omapGoTo(omap_view_t *mv, int tx, int ty) { mv->dyThresh = mv->map->tiles->tileHeight * 2; /* draw the tiles */ - modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); + omodexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); py=0; i=mv->ty * mv->map->width + mv->tx; for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { @@ -323,12 +323,12 @@ omapGoTo(omap_view_t *mv, int tx, int ty) { void -omapDrawTile(otiles_t *t, word i, page_t *page, word x, word y) { +omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y) { word rx; word ry; rx = (i % t->cols) * t->tileWidth; ry = (i / t->cols) * t->tileHeight; - modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); + omodexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); } diff --git a/src/inputest.c b/src/inputest.c index 65fafd87..8d76a7fc 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -29,9 +29,10 @@ void main(int argc, char *argv[]) { static global_game_variables_t gvar; - //extern struct inconfig inpu; +#ifdef __DEBUG_InputMgr__ dbg_testkeyin=0; dbg_testcontrolnoisy=1; +#endif start_timer(&gvar); //Startup16(&gvar); IN_Startup(&gvar); @@ -108,6 +109,8 @@ ctrl_Keyboard1); //printf("%u\n", in.Keyboard[sc_Escape]); printf("inputest.exe "); printf("version %s\n", VERSION); +#ifdef __DEBUG_InputMgr__ printf("testkeyin=%u\n", dbg_testkeyin); printf("testcontrolnoisy=%u\n", dbg_testcontrolnoisy); +#endif } diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h index ede5c359..295b7146 100755 --- a/src/lib/16_dbg.h +++ b/src/lib/16_dbg.h @@ -7,7 +7,7 @@ #include "src/lib/16_tdef.h" #define __DEBUG__ -#define __DEBUG_InputMgr__ +//#define __DEBUG_InputMgr__ #define __DEBUG_MAP__ //#define __DEBUG_2__ //#define __DEBUG_CA__ diff --git a/src/lib/16render.c b/src/lib/16render.c index d159c2a3..0b4a0497 100755 --- a/src/lib/16render.c +++ b/src/lib/16render.c @@ -52,7 +52,7 @@ void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, in //printf("%d,%d p(%d,%d) r(%d,%d) rwh(%d,%d)\n", x, y, px, py, rx, ry, rw, rh); for(plane=0; plane < 4; plane++) { i=PEEE+prh; - modexSelectPlane(PLANE(plane-1)); + omodexSelectPlane(PLANE(plane-1)); for(; y < py+rh; y++) { _fmemcpy(page->data + (((page->width/4) * (y)) + ((x) / 4)), &(p->plane[plane][i]), prw); i+=PE; @@ -120,7 +120,7 @@ oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) /* TODO Make this fast. It's SLOOOOOOW */ for(plane=0; plane < 4; plane++) { - modexSelectPlane(PLANE(plane+x)); + omodexSelectPlane(PLANE(plane+x)); for(px = plane; px < bmp->width; px+=4) { offset=px; for(py=0; pyheight; py++) { diff --git a/src/lib/16render.h b/src/lib/16render.h index 7287bf1e..bea992be 100755 --- a/src/lib/16render.h +++ b/src/lib/16render.h @@ -23,7 +23,8 @@ #ifndef __RENDER_H__ #define __RENDER_H__ -#include "src/lib/16_vl.h" +//#include "src/lib/16_vl.h" +#include "16/src/lib/omodex16.h" void modexDrawPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite); void modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite); /*temp*/ diff --git a/src/vrstest.c b/src/vrstest.c index 2e6a90bb..7ab82a4c 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -28,7 +28,9 @@ #include "src/lib/16_ca.h" #include "src/lib/16_mm.h" +#ifdef __DEBUG_InputMgr__ extern boolean dbg_nointest; +#endif boolean panswitch; static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ @@ -53,7 +55,9 @@ void main() int size=0; */ +#ifdef __DEBUG_InputMgr__ dbg_nointest=0; +#endif Startup16(&gvar); /* CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar); -- 2.39.2