From: sparky4 Date: Fri, 24 Jul 2015 17:34:06 +0000 (-0500) Subject: wwww major changes in the repo and i did some house keeping in the repo ^^ and i... X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=fbe03063d70bda97992c9927f44e2ced8cee4dab wwww major changes in the repo and i did some house keeping in the repo ^^ and i added a new non test function named bakapi.exe! It is just my screen saver! wwww modified: 16.exe modified: 16.hed deleted: 16/BAKAPI.EXE deleted: 16/DOS_GFX.EXE deleted: 16/DOS_GFX.SMP deleted: 16/DOS_KB.EXE deleted: 16/INPUTEST.EXE deleted: 16/dos_gfx.cpp deleted: 16/dos_gfx.h deleted: 16/dos_kb.c deleted: 16/dos_kb.h deleted: 16/k.bat renamed: old.7z -> 16/old16.7z deleted: 16/x.bat deleted: 16/xx.bat deleted: DEBUG.16 deleted: MMDUMP.16 deleted: PROFILE.16 new file: bakapi.exe renamed: PTMP.TXT -> data/ptmp.16 renamed: 16/16.txt -> doc/16.txt renamed: TIMELINE.TXT -> doc/timeline.txt modified: fontgfx.exe deleted: fonttes0.exe modified: makefile modified: maptest.exe deleted: miditest.exe modified: palettec.exe modified: pcxtest.exe modified: run.bat modified: sountest.exe new file: src/bakapi.c new file: src/bakapi.h modified: src/lib/16_head.h new file: src/lib/bakapee.c new file: src/lib/bakapee.h modified: src/lib/modex16.c modified: test.exe modified: test2.exe deleted: testemm.exe deleted: testemm0.exe deleted: testsnd.exe --- diff --git a/16.exe b/16.exe index 50e959ff..755921db 100644 Binary files a/16.exe and b/16.exe differ diff --git a/16.hed b/16.hed index e4b49e1a..77986131 100644 Binary files a/16.hed and b/16.hed differ diff --git a/16/BAKAPI.EXE b/16/BAKAPI.EXE deleted file mode 100644 index ba0690ed..00000000 Binary files a/16/BAKAPI.EXE and /dev/null differ diff --git a/16/DOS_GFX.EXE b/16/DOS_GFX.EXE deleted file mode 100644 index 586644a4..00000000 Binary files a/16/DOS_GFX.EXE and /dev/null differ diff --git a/16/DOS_GFX.SMP b/16/DOS_GFX.SMP deleted file mode 100644 index e69de29b..00000000 diff --git a/16/DOS_KB.EXE b/16/DOS_KB.EXE deleted file mode 100644 index 35271741..00000000 Binary files a/16/DOS_KB.EXE and /dev/null differ diff --git a/16/INPUTEST.EXE b/16/INPUTEST.EXE deleted file mode 100644 index 9b3ec195..00000000 Binary files a/16/INPUTEST.EXE and /dev/null differ diff --git a/16/dos_gfx.cpp b/16/dos_gfx.cpp deleted file mode 100644 index 268b99ae..00000000 --- a/16/dos_gfx.cpp +++ /dev/null @@ -1,402 +0,0 @@ -//DOS Graphics thingy by sparky4 licence GPL v2 -//a special thanks to everyone to release source code for mode X -/*src\lib\*/ -#include "dos_gfx.h" -//#include "lib\modex16.h" //____ - -int old_mode; -//color ‚Ä‚·‚Æ -short gq = LGQ; - -//‚Ä‚·‚Æ -short bakax = 0, bakay = 0; -word xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0; -byte coor; - -byte *vga = (byte *) MK_FP(0xA000, 0); - -/* - * Comment out the following #define if you don't want the testing main() - * to be included. - */ -#define TESTING -//#define TILE - -///////////////////////////////////////////////////////////////////////////// -// // -// setvideo() - This function Manages the video modes // -// // -///////////////////////////////////////////////////////////////////////////// -void setvideo(/*byte mode, */short vq){ - union REGS in, out; - - if(!vq){ // deinit the video - // change to the video mode we were in before we switched to mode 13h - //mxSetMode( MX_TEXT ); - mxTerm(); - in.h.ah = 0x00; - in.h.al = old_mode; - int86(0x10, &in, &out); - - }else if(vq==1){ // init the video - // get old video mode - in.h.ah = 0xf; - int86(0x10, &in, &out); - old_mode = out.h.al; - - // enter mode - mxInit(); - mxSetMode( MX_320x240 ); -// mxSetVirtualScreen(SW+(SW/4), SH+(SH/4)); -// mxSetVirtualScreen(SW*2, SH*2); - mxSetVirtualScreen(VW,BH); -// mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4))); - mxSetClip(true); - mxSetClipRegion(0, 0, VW, BH); - mxPan(TILEWH*2,TILEWH*2); - //mxSetClipRegion(0, VH+1, VW, (TILEWH*BUFFMX)); - } -} - -void pdump(){ - int mult=(QUADWH)/2; - int palq=(mult)*16; - int palcol=0; - for(int paly=0; paly0){ - yy++; - d3y--; - } - } - if(bakax<0){ - xx--; - }else - if(bakax>0){ - xx++; - } - }else{ - if(q==16) - { - if(!bakax){ - xx--; - }else if(bakax>0){ - xx++; - } - if(!bakay){ - yy--; - }else if(bakay>0){ - yy++; - } - }else{ - if(!bakax){ - #ifdef TILE - xx-=TILEWH; - #else - xx--; - #endif - }else if(bakax>1){ - #ifdef TILE - xx+=TILEWH; - #else - xx++; - #endif - } - if(!bakay){ - #ifdef TILE - yy-=TILEWH; - #else - yy--; - #endif - }else if(bakay>1){ - #ifdef TILE - yy+=TILEWH; - #else - yy++; - #endif - } - } - } - // fixer - if(q!=16){ - #ifdef TILE - if(xx<0) xx=(VW-TILEWH); - if(yy<0) yy=(VH-TILEWH); - if(xx>(VW-TILEWH)) xx=0; - if(yy>(VH-TILEWH)/*+(TILEWH*BUFFMX)*/) yy=0; - #else - if(xx<0) xx=VW; - if(yy<0) yy=VH; - if(xx>VW) xx=0; - if(yy>VH) yy=0; - #endif - } - -//interesting effects - if(q==16) - { - short tx=0,ty=0; - tx+=xx+16; - ty+=yy+16; - mxPutPixel(tx, ty, coor); - //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH); - - // plot the pixel - }else{ - #ifdef TILE - mxFillBox(xx, yy, TILEWH, TILEWH, coor, OP_SET); - #else - mxPutPixel(xx, yy, coor); - #endif - } - - if(q==2) - #ifdef TILE - mxFillBox((rand()*TILEWH)%VW, (rand()*TILEWH)%(VH), TILEWH, TILEWH, 0, OP_SET); - #else - mxPutPixel(rand()%VW, rand()%(VH), 0); - #endif - if(q==16) mxPutPixel(rand()%VW, rand()%(VH), 0); - if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; } //random 3 switch - gq++; -//if(xx<0||xx>320||yy<0||yy>(SH*3)) -// printf("%d %d %d %d %d\n", xx, yy, coor, bakax, bakay); - }else gq = LGQ; - return gq; -} - - -/* - * The library testing routines follows below. - */ - -#ifdef TESTING - -/* - * Library test (program) entry point. - */ - -int main(void) - { - //bitmap_t bmp; //____ - //bmp = modexLoadPcx("chikyuu.pcx"); //____ - short key,d,xpos,ypos,xdir,ydir; - int ch=0x0; - // main variables - d=4; // switch variable - key=2; // default screensaver number - xpos=TILEWH*2; - ypos=TILEWH*2; - xdir=1; - ydir=1; - setvideo(1); - //modexPalUpdate(bmp.palette); //____ - //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____ - //getch(); //____ -// screen savers - -/*while(d!=0){ // on! - if(!kbhit()){ // conditions of screen saver - ding(key); - }else{ - setvideo(0); - // user imput switch - printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.\n", getch()); // prompt the user - scanf("%d", &key); - //if(key==3){xx=yy=0;} // crazy screen saver wwww - if(key==5) d=0; - setvideo(1); - } - }*/ // else off - //mxFillBox(0, 0, VW, BH, 10, OP_SET); - while(1){ // conditions of screen saver - while(!kbhit()){ - ding(key); - } - //end of screen savers - //doTest(); -/* for (int x = 0; x < VW; ++x) - { - mxPutPixel(x, 0, 15); - mxPutPixel(x, SH-1, 15); - } - for (int y = 0; y < VH; ++y) - { - mxPutPixel(0, y, 15); - mxPutPixel(SW-1, y, 15); - } - for (int x = 0; x < VW; ++x) - { - mxPutPixel(x, 0, 15); - mxPutPixel(x, VH-1, 15); - } - for (int y = 240; y < VH; ++y) - { - mxPutPixel(0, y, 15); - mxPutPixel(VW-1, y, 15); - } - */ - pdump(); - getch(); - //text box - mxSetTextColor(10, OP_TRANS); //set font - mxBitBlt(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, BS); //copy background - mxFillBox(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, OP_SET); // background for text box - //+(QUADWH*6) - mxOutText(xpos+1, ypos+SH-48, "========================================"); - mxOutText(xpos+1, ypos+SH-40, "| |Chikyuu:$line1"); - mxOutText(xpos+1, ypos+SH-32, "| |$line2"); - mxOutText(xpos+1, ypos+SH-24, "| |$line3"); - mxOutText(xpos+1, ypos+SH-16, "| |$line4"); - mxOutText(xpos+1, ypos+SH-8, "========================================"); - mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~ - getch(); - mxBitBlt(0, BS, SW, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background - getch(); - while(!kbhit()){ - //for(int i=0;i(VW-SW-1)) || (xpos<1))delay(500); - //mxWaitRetrace(); -//mxBitBlt(32, (SH+32), SW, SH, xpos, ypos); -mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); -//xpos=ypos=TILEWH*2; -mxPan(32,32); - //} - if( (xpos>(VW-SW-1)) || (xpos<1)){xdir=-xdir;} - if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change - // direction! } -//mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos); -//mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); - } - ch=getch(); - if(ch==0x71)break; // 'q' - if(ch==0x1b)break; // 'ESC' - } - setvideo(0); - printf("wwww\nFull Buffer Virtual Resolution: %dx%d\n", VW,BH); - printf("Virtual Resolution: %dx%d\n", VW,VH); - printf("Resolution: %dx%d\n", SW,SH); - printf("Mode X Library Version: %d\n", mxGetVersion()); - printf("bakapi ver. 1.04.09.04\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v2\n"); - return 0; - } - -#endif diff --git a/16/dos_gfx.h b/16/dos_gfx.h deleted file mode 100644 index cb47dc91..00000000 --- a/16/dos_gfx.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _DOSLIB_GFX_H_ -#define _DOSLIB_GFX_H_ -#include -#include -#include "lib\lib_com.h" -#include "lib\x\modex.h" -#include "lib\modex16.h" //____ - -#define NUM_COLORS 256 // number of colors in vga mode -//static lgq=NUM_COLORS/(1/8) -//static hgq=NUM_COLORS/(1/8) -#define BONK 400 -#define LGQ 32 -#define HGQ 55 -#define TILEWH 16 -#define QUADWH TILEWH/2 -#define BUFFMX 4 -/*byte SIZE = 80; // Size = 40 = 1 across, 4 down - // Size = 80 = 2 across, 2 down - // Size = 160 = 4 across, 1 down*/ -//#define VMEM 0xA000 // = vga - -#define SW 320 -#define SH 240 -//#define VW 560 -//#define VH 416 -#define VW (SW+64) -#define VH (SH+64) -#define BS (VH*2) // buffer space! not BULLSHIT -#define BH BS+(TILEWH*BUFFMX) // buffer resolution - -//void drawChar(int x, int y, int color, byte c); -//void drawText(int x, int y, int color, byte string); -void setvideo(/*byte mode, */short vq); -//void setvbuff(int vq); -//void updatevbuff(); -void cls(byte color, byte *Where); -//void clearscr(); -//void plotpixel(int x, int y, byte color, byte *Where); -//void plotpixelfast(int x, int y, byte color, byte *Where); -//void putPixel_X(int x, int y, byte color); -//void putColorBox_X(int x, int y, int w, int h, byte color); -//void vScroll(int rows); -//void scrolly(int bong); -//void wait_for_retrace(void); // Waits for vertical retrace -//void BlockMove(); -//void eraseplayer(int x, int y); -//void drawplayer(int x, int y, int color); -short colortest(); -short colorz(); -void ssd(short svq); -void pdump(); -//void tulip(); -short ding(int q); - -#endif/*_DOSLIB_GFX_H_*/ diff --git a/16/dos_kb.c b/16/dos_kb.c deleted file mode 100644 index 2bebd707..00000000 --- a/16/dos_kb.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Thanks to Alex Russell for example code */ -/* Thanks to Gary Neal for example code */ -/* working out the licencing~ */ -#include "src/lib/dos_kb.h" - -// keyboard buffer -static byte key[NUM_SCANCODES]; // pressed -static byte kea[NUM_SCANCODES]; // released - -#ifdef __cplusplus /* Function must be declared C style */ -extern "C" { -#endif -static void interrupt (far *oldkb)(void) = NULL; /* BIOS keyboard handler */ -#ifdef __cplusplus -} -#endif - -/* - * Comment out the following #define if you don't want the testing main() - * to be included. - */ -//#define TESTING -#define TESTING2 - -/*****************NEW KEYBOARD 09h ISR***********************/ -void interrupt newkb(void){ - byte kee; - register char qx; - - kee = inp(0x60); /* Read the keyboard scan code */ - - /* Clear keyboard controller on XT machines */ - qx = inp(0x61); /* Get keyboard control register */ - qx |= 0x82; - outp(0x61, qx); /* Toggle acknowledge bit high */ - qx &= 0x7F; - outp(0x61, qx); /* Toggle acknowledge bit low */ - - /* Interpret the scan code and set our flags */ - #ifdef TESTING2 - //printf("%d[%d]\n",kee,key[kee]); - printf("\0"); // bug - #endif - if(kee & 0x80) - key[kee & 0x7F] = 0; // a key is released - else - key[kee] = kea[kee] = 1; // a key is pressed - - /* Acknowledge the interrupt to the programmable interrupt controller */ - outp(0x20, 0x20); /* Signal non specific end of interrupt */ -} - -/* ---------------------- init_keyboard() ---------------- April 17,1993 */ -/* restore the bios keyboard handler */ -/* ---------------------- deinit_keyboard() -------------- April 17,1993 */ -void setkb(int vq){ - int i; /* Index variable */ - if(!vq){ // deinitiation - /* Abort if our function pointer has no valid address */ - if(oldkb == NULL) return; - /* Set address in our function pointer in interrupt vector table */ - _dos_setvect(9, oldkb); - /* Reset our function pointer to contain no valid address */ - oldkb = NULL; - #ifdef TESTING - /* Print the key heap */ - printf("\n"); - for(i=0; i scroll.out -@rem wmake maptest.exemaptest.exe > maptest.out -wmake maptest0.exemaptest0.exe +@echo off +wmake clean +wmake exmmtest.exe > exmmtest.16 +@rem wmakescroll.exe > scroll.16 +@rem wmake maptest.exemaptest.exe > maptest.16 diff --git a/sountest.exe b/sountest.exe index eb47aad2..87ad9cd7 100644 Binary files a/sountest.exe and b/sountest.exe differ diff --git a/src/bakapi.c b/src/bakapi.c new file mode 100644 index 00000000..16ef8956 --- /dev/null +++ b/src/bakapi.c @@ -0,0 +1,158 @@ +/* Project 16 Source Code‾ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as publiSCREEN_HEIGHTed by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You SCREEN_HEIGHTould have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "src/bakapi.h" + +/* + * BAKAPEE! + */ +void +main(int argc, char *argv[]) +{ + global_game_variables_t gamevars; + bakapee_t bakapee; + page_t screen; + word key,d,xpos,ypos,xdir,ydir; + int ch=0x0; + // main variables values + d=4; // switch variable + key=2; // default screensaver number + xpos=TILEWH*2; + ypos=TILEWH*2; + xdir=1; + ydir=1; + bakapee.xx = rand()&0%SCREEN_WIDTH; + bakapee.yy = rand()&0%SCREEN_HEIGHT; + bakapee.gq = LGQ; + bakapee.sx=0; + bakapee.sy=0; + bakapee.bakax=0; + bakapee.bakay=0; + + /* setup camera and screen‾ */ + screen = modexDefaultPage(); + screen.width += (TILEWH*2); + screen.height += (TILEWH*2); + textInit(); + + //modexPalUpdate(bmp.palette); //____ + //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____ + //getch(); //____ + +// screen savers +#ifdef BOINK + while(d!=0) // on! + { + if(!kbhit()) + { // conditions of screen saver + ding(&screen, &bakapee, key); + } + else + { + setVGAmodeX(&gamevars, 0); + // user imput switch + printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.Â¥n", getch()); // prompt the user + scanf("%d", &key); + //if(key==3){xx=yy=0;} // crazy screen saver wwww + if(key==0) d=0; + setVGAmodeX(&gamevars, 1); + } + } +#else + setVGAmodeX(&gamevars, 1); + while(1) + { // conditions of screen saver + while(!kbhit()) + { + ding(&screen, &bakapee, key); + } + //end of screen savers + /*for(int x = 0; x < screen.width; ++x) + { + modexputPixel(&page, x, 0, 15); + mxPutPixel(x, SCREEN_HEIGHT-1, 15); + } + for (int y = 0; y < VH; ++y) + { + mxPutPixel(0, y, 15); + mxPutPixel(SCREEN_WIDTH-1, y, 15); + } + for (int x = 0; x < VW; ++x) + { + mxPutPixel(x, 0, 15); + mxPutPixel(x, VH-1, 15); + } + for (int y = 240; y < VH; ++y) + { + mxPutPixel(0, y, 15); + mxPutPixel(VW-1, y, 15); + }*/ + pdump(&screen); + getch(); + //text box + /*++++mxBitBlt(xpos, ypos+(TILEWH*12), SCREEN_WIDTH, TILEWH*BUFFMX, 0, BS); //copy background + mxFillBox(xpos, ypos+(TILEWH*12), SCREEN_WIDTH, TILEWH*BUFFMX, 0, OP_SET); // background for text box + //+(QUADWH*6) + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-48, "========================================"); + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-40, "| |Chikyuu:$line1"); + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-32, "| |$line2"); + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-24, "| |$line3"); + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-16, "| |$line4"); + mxOutText(xpos+1, ypos+SCREEN_HEIGHT-8, "========================================"); + mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat‾ + getch(); + mxBitBlt(0, BS, SCREEN_WIDTH, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background + getch();++++*/ + while(!kbhit()) + { + //for(int i=0;i(VW-SCREEN_WIDTH-1)) || (xpos<1))delay(500); + //mxWaitRetrace(); +//mxBitBlt(32, (SCREEN_HEIGHT+32), SCREEN_WIDTH, SCREEN_HEIGHT, xpos, ypos); +//++++mxBitBlt(TILEWH*2, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, TILEWH*2, TILEWH*2); +//xpos=ypos=TILEWH*2; + //????modexPanPage(&screen, 32, 32); + //} + if( (xpos>(VW-SCREEN_WIDTH-1)) || (xpos<1)){xdir=-xdir;} + if( (ypos>(BH-SCREEN_HEIGHT-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change + //}// direction! +//mxBitBlt(32, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, xpos, ypos); +//mxBitBlt(TILEWH*2, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, TILEWH*2, TILEWH*2); + } + ch=getch(); + if(ch==0x71)break; // 'q' + if(ch==0x1b)break; // 'ESC' + } + setVGAmodeX(&gamevars, 0); +#endif + printf("bakapi ver. 1.04.13.04Â¥nis made by sparky4(≧ω≦) feel free to use it ^^Â¥nLicence: GPL v3Â¥n"); +} +//pee! diff --git a/src/bakapi.h b/src/bakapi.h new file mode 100644 index 00000000..6e371573 --- /dev/null +++ b/src/bakapi.h @@ -0,0 +1,30 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __BAKAPI_H_ +#define __BAKAPI_H_ + +#include "src/lib/bakapee.h" + +#define BOINK + +#endif /*__BAKAPI_H_*/ diff --git a/src/lib/16_head.h b/src/lib/16_head.h index ee6ebf5f..c0bc4cfb 100644 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -41,6 +41,7 @@ #include #include #include +#include #include "src/lib/types.h" /* Control codes for all keys on the keyboard */ diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c new file mode 100644 index 00000000..8dbca62b --- /dev/null +++ b/src/lib/bakapee.c @@ -0,0 +1,327 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as publiSCREEN_HEIGHTed by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You SCREEN_HEIGHTould have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "src/lib/bakapee.h" + +///////////////////////////////////////////////////////////////////////////// +// // +// setvideo() - This function Manages the video modes // +// // +///////////////////////////////////////////////////////////////////////////// +void setVGAmodeX(global_game_variables_t *vid, boolean vq) +{ + union REGS in, out; + + if(!vq) + { // deinit the video + // change to the video mode we were in before we switched to mode 13h + modexLeave(); + in.h.ah = 0x00; + in.h.al = vid->old_mode; + int86(0x10, &in, &out); + + }else if(vq==1){ // init the video + // get old video mode + in.h.ah = 0xf; + int86(0x10, &in, &out); + vid->old_mode = out.h.al; + // enter mode + modexEnter(); + } +} + +void pdump(page_t *pee) +{ + int mult=(QUADWH); + int palq=(mult)*TILEWH; + int palcol=0; + int palx, paly; + for(paly=0; palywidth, page->height, color); + _fmemset(Where, color, page->width*(page->height*2)); +} + +//color ‚Ä‚·‚Æ +void colortest(page_t *page, bakapee_t *pee) +{ + if(pee->gq < 256) + { + cls(page, pee->gq, VGA); + pee->gq++; + }else pee->gq = 0; +} + +//color ‚Ä‚·‚Æ +void colorz(page_t *page, bakapee_t *pee) +{ + if(pee->gq <= HGQ) + { + cls(page, pee->gq, VGA); + pee->gq++; + }else pee->gq = LGQ; +} + +//slow spectrum down +void ssd(page_t *page, bakapee_t *pee, word svq) +{ + if(pee->sy < SCREEN_HEIGHT+1) + { + if(pee->sx < SCREEN_WIDTH+1) + { + //mxPutPixel(sx, sy, coor); + printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor); + pee->sx++; + }else pee->sx = 0; + if(pee->sx == SCREEN_WIDTH) + { + pee->sy++; + if(svq == 7) pee->coor++; + if(pee->sy == SCREEN_HEIGHT && svq == 8) pee->coor = rand()%256; + } + }else pee->sy = 0; +} + +void dingpp(page_t *page, bakapee_t *pee) +{ +#ifdef TILE + modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor); +#else + modexputPixel(page, pee->xx, pee->yy, pee->coor); +#endif +} + +void dingo(bakapee_t *pee) +{ + #ifdef TILE + if(pee->xx<0) pee->xx=(SCREEN_WIDTH-TILEWH); + if(pee->yy<0) pee->yy=(SCREEN_HEIGHT-TILEWH); + if(pee->xx>(SCREEN_WIDTH-TILEWH)) pee->xx=0; + if(pee->yy>(SCREEN_HEIGHT-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0; + #else + if(pee->xx<0) pee->xx=SCREEN_WIDTH; + if(pee->yy<0) pee->yy=SCREEN_HEIGHT; + if(pee->xx>SCREEN_WIDTH) pee->xx=0; + if(pee->yy>SCREEN_HEIGHT) pee->yy=0; + #endif +} + +void dingas(bakapee_t *pee) +{ + if(pee->gq == BONK) dingu(pee); + if(!pee->bakax) + { + #ifdef TILE + pee->xx-=TILEWH; + #else + pee->xx--; + #endif + } + else if(pee->bakax>1) + { + #ifdef TILE + pee->xx+=TILEWH; + #else + pee->xx++; + #endif + } + if(!pee->bakay) + { + #ifdef TILE + pee->yy-=TILEWH; + #else + pee->yy--; + #endif + } + else if(pee->bakay>1) + { + #ifdef TILE + pee->yy+=TILEWH; + #else + pee->yy++; + #endif + } +} + +void dingu(bakapee_t *pee) +{ + if(pee->coor < HGQ && pee->coor < LGQ) pee->coor = LGQ; + if(pee->coor < HGQ) + { + pee->coor++; + }else{ pee->coor = LGQ; + pee->bakax = rand()%3; pee->bakay = rand()%3; + } +} + +/*-----------ding-------------*/ +void ding(page_t *page, bakapee_t *pee, word q) +{ + word d3y, tx=0,ty=0; + +//++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ; + switch(q) + { + case 1: + if(pee->gqxx==SCREEN_WIDTH){pee->bakax=0;} + if(pee->xx==0){pee->bakax=1;} + if(pee->yy==SCREEN_HEIGHT){pee->bakay=0;} + if(pee->yy==0){pee->bakay=1;} + pee->gq++; + }else pee->gq = LGQ; + break; + case 2: + if(pee->gqbakax = rand()%3; pee->bakay = rand()%3; + pee->gq++; + }else pee->gq = LGQ; + break; + case 3: + if(pee->gqxx!=SCREEN_WIDTH||pee->yy!=SCREEN_HEIGHT) + { + if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;} + if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;} + if(pee->xx==SCREEN_WIDTH){pee->bakax=-1;pee->bakay=-1;d3y=1;} + if(pee->yy==SCREEN_HEIGHT){pee->bakax=1;pee->bakay=0;d3y=1;} + }else if(pee->xx==SCREEN_WIDTH&&pee->yy==SCREEN_HEIGHT) pee->xx=pee->yy=0; + if(d3y) + { + if(pee->bakay<0) + { + pee->yy--; + d3y--; + }else + if(pee->bakay>0) + { + pee->yy++; + d3y--; + } + } + if(pee->bakax<0) + { + pee->xx--; + }else + if(pee->bakax>0) + { + pee->xx++; + } + pee->gq++; + }else pee->gq = LGQ; + break; + case 4: + if(pee->gqbakax = rand()%3; pee->bakay = rand()%3; + pee->gq++; + }else pee->gq = LGQ; + break; + case 5: + colortest(page, pee); + break; + case 6: + pee->coor = rand()%256; + cls(page, pee->coor, VGA); + break; + case 7: + if(pee->gq <= HGQ) + { + ssd(page, pee, q); + pee->gq++; + }else pee->gq = LGQ; + break; + case 8: + colorz(page, pee); + modexprint(page, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 1, 47, 0, "bakapi"); + break; + case 9: + if(pee->gq <= HGQ) + { + ssd(page, pee, q); pee->coor++; + pee->gq++; + }else pee->gq = LGQ; + break; + case 10: + ssd(page, pee, q); /*printf("%d\n", pee->coor);*/ + break; + case 11: + colorz(page, pee); delay(100); + break; + + case 16: //interesting effects + if(pee->gqbakax){ pee->xx--;} + else if(pee->bakax>0){ pee->xx++; } + if(!pee->bakay){ pee->yy--;} + else if(pee->bakay>0){ pee->yy++; } + dingas(pee); + tx+=pee->xx+TILEWH+4; + ty+=pee->yy+TILEWH+4; + modexClearRegion(page, tx, ty, 4, 4, pee->coor); +#ifdef TILE + modexClearRegion(page, (rand()*TILEWH)%SCREEN_WIDTH, (rand()*TILEWH)%(SCREEN_HEIGHT), TILEWH, TILEWH, 0); +#else + modexputPixel(page, rand()%SCREEN_WIDTH, rand()%(SCREEN_HEIGHT), 0); +#endif + pee->bakax = rand()%3; pee->bakay = rand()%3; + //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); + pee->gq++; + }else pee->gq = LGQ; + break; + case 0: + return; + break; + default: + return; + break; + } +} diff --git a/src/lib/bakapee.h b/src/lib/bakapee.h new file mode 100644 index 00000000..672d8046 --- /dev/null +++ b/src/lib/bakapee.h @@ -0,0 +1,59 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __BAKAPEE_H_ +#define __BAKAPEE_H_ + +#include "src/lib/16_head.h" +#include "src/lib/modex16.h" + +#define TILEWH 16 +#define QUADWH TILEWH/2 +#define BONK 400 +#define LGQ 32 +#define HGQ 55 + +typedef struct { + word gq; + sword bakax, bakay; + sword xx, yy, sx, sy; + byte coor; +} bakapee_t; + +typedef struct +{ + int old_mode; //old video mode before game! +} global_game_variables_t; + +void setVGAmodeX(global_game_variables_t *vid, boolean vq); +void pdump(page_t *pee); +void cls(page_t *page, byte color, byte *Where); +void colortest(page_t *page, bakapee_t *pee); +void colorz(page_t *page, bakapee_t *pee); +void ssd(page_t *page, bakapee_t *pee, word svq); +void dingpp(page_t *page, bakapee_t *pee); +void dingo(bakapee_t *pee); +void dingas(bakapee_t *pee); +void dingu(bakapee_t *pee); +void ding(page_t *page, bakapee_t *pee, word q); + +#endif /*__BAKAPEE_H_*/ diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 1e086ea7..2bb0a348 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -20,9 +20,6 @@ * */ -#include -#include -#include #include #include #include diff --git a/test.exe b/test.exe index bcd6c01d..9bb2f6ae 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 2e214f45..69f2adc9 100644 Binary files a/test2.exe and b/test2.exe differ diff --git a/testemm.exe b/testemm.exe deleted file mode 100644 index 55c56d31..00000000 Binary files a/testemm.exe and /dev/null differ diff --git a/testemm0.exe b/testemm0.exe deleted file mode 100644 index cb076ad2..00000000 Binary files a/testemm0.exe and /dev/null differ diff --git a/testsnd.exe b/testsnd.exe deleted file mode 100644 index b54d1416..00000000 Binary files a/testsnd.exe and /dev/null differ