The first stable version of N-sider. Level editor, 2 redraw technologies and save/load data added.

git-svn-id: svn://kolibrios.org@5266 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eugene455 2014-12-26 20:27:51 +00:00
parent d3647f7eed
commit efd8f1922c
40 changed files with 3405 additions and 0 deletions

View File

@ -0,0 +1,9 @@
if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
CFLAGS = CFLAGS .. " -I include"
LDFLAGS = LDFLAGS .. " -T kolibri.ld"
OBJS += tup.foreach_rule({"start.asm", "kolibrisys/*.asm"}, "fasm %f %o", "%B.o")
compile_gcc{"game.c"}
compile_gcc{"stdio/*.c"}
link_gcc("nsider")

View File

@ -0,0 +1 @@
ktcc.kex simple.c libck.a -o program

View File

@ -0,0 +1,697 @@
//screen Width and Height
#define Width 600
#define Height 600
int ScreenX=0;
int ScreenY=0;
int OffsetX=0;
int OffsetY=0;
int BufferDraw [Width][Height];
char BufferCarry [Height][Width][3];
int BufferCarry2 [Height][Width];
int DRAW_TECH=0;
int Analyx [Width][Height];
int CollideVerts[10][2]={};
int DeltaH [8]={11,16,19,20,21,22,23,23};
//-1-quit, 0-menu, 1-game
int GAME_TYPE=0;
int TactCount=0;
int GLOBAL_SPEED=0;
//colors
int COLOR_INDEX=0;
char RAINBOW_NAME[7][7]={"red","orange","yellow","green","blue","indigo","violet"};
int RAINBOW_TABLE[7][5]= {{0x00ff0000, 0x00e80c7a, 0x00ff0dff, 0x00e82c0c, 0x00ff530d},
{0x00ff4700, 0x00e8690c, 0x00ff970d, 0x00ff0d18, 0x00e8290c},
{0x00ffff00, 0x00e8d20c, 0x00ffce0d, 0x009be80c, 0x0056ff0d},
{0x0000ff00, 0x000ce84a, 0x0059e80c, 0x000dff96, 0x00b6ff0d},
{0x0000ffff, 0x000d7fff, 0x000caeeb, 0x000dff76, 0x000ce8aa},
{0x000000ff, 0x000c46eb, 0x00480ce8, 0x00910dff, 0x000d8cff},
{0x006700ff, 0x00a00ce8, 0x00f20dff, 0x000d2eff, 0x00280ce8}};
int GLOBAL_BLOCKCOLOR=0x00e80c7a;
int GLOBAL_BATUTCOLOR=0x00ff0dff;
int GLOBAL_PITCOLOR=0x00e82c0c;
int GLOBAL_FLAGCOLOR=0x00ff530d;
int GLOBAL_BACKGROUNDCOLOR=0x00000000;
int GLOBAL_FRONTCOLOR=0x00ffffff;
//menu settings
int MENU_SELECTED=0;
char NUMBER[100]="0";
int CURRENT_LEVEL=3;
int MAX_LEVEL=3;
int TO_NEXT_LEVEL=0;
int DeltaSpeed=0;
int GLOBAL_CHECKPOINT=0;
int SPAWN_Y=0;
int isRestart=1;
int CurrentCheck=0;
//Hero data
int HeroX=100;
int HeroY=100;
int HeroSides=3;
int HeroAngle=0;
int HeroFly=0;
char HeroIsDead=0;
int HeroColor=0x00ff0000;
char Key=0;
//Saveload folder
int SAVE_FOLDER_TYPE=0;
//EDITOR
int Tile_X=0;
int Tile_Y=0;
int Panel=0; //0-grid,1-tools, 2-props
int Tile_Type=0;
int Q_SELECTED=0;
char TILENAME[6][11]={"empty","block","spike","jump pad","checkpt","finish"};
//TIMING
int OLD_FPS=60;
int NEW_FPS=60;
//OTHER
int THE_END_COUNT=600;
//Libraries
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <kolibrisys.h>
#include <Gamealphabet.h>
#include <Shimath.h>
#include <Draw2D.h>
#include <Levels.h>
#include <Gamefunctions.h>
//result of getKey is key character. Condition for Escape - if (getKey()==27)
char getKey() {
int NewKey=_ksys_get_key();
NewKey/=256;
return (NewKey%256);
}
void LoadData () {
FILE *Profile;
if (SAVE_FOLDER_TYPE==1) {
Profile=fopen ("/usbhd0/1/Profile.bin","rb");
} else {
Profile=fopen ("Profile.bin","rb");
}
char Format=0;
Format=fgetc (Profile);
if (Format!='N') {
DrawText (100,300,"error (cannot load data)",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
MENU_SELECTED=1;
fclose (Profile);
return;
}
//Loading operations
fread (&(COLOR_INDEX), sizeof(int),1,Profile);
HeroColor=COLOR_INDEX;
fread (&(GLOBAL_BACKGROUNDCOLOR), sizeof(int),1,Profile);
fread (&(GLOBAL_FRONTCOLOR),sizeof(int),1,Profile);
Update();
fread (&(DRAW_TECH),sizeof(int),1,Profile);
Update();
MAX_LEVEL=fgetc (Profile);
CURRENT_LEVEL=MAX_LEVEL;
fread (&(LevelProps[0][2]), sizeof(int),1, Profile);
fread (USER_LEVEL0,1,9*LEVEL_MAXLEN,Profile);
fread (&(LevelProps[1][2]), sizeof(int),1,Profile);
fread (USER_LEVEL1,1,9*LEVEL_MAXLEN,Profile);
fread (&(LevelProps[2][2]), sizeof(int),1,Profile);
fread (USER_LEVEL2,1,9*LEVEL_MAXLEN,Profile);
DrawText (100,300,"loaded successfully",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
Update();
MENU_SELECTED=1;
fclose (Profile);
}
void SaveData () {
FILE *Profile;
if (SAVE_FOLDER_TYPE==1) {
Profile=fopen ("/usbhd0/1/Profile.bin","wb");
} else {
Profile=fopen ("Profile.bin","wb");
}
if (Profile==NULL) {
DrawText (100,300,"error (cannot save data)",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
MENU_SELECTED=1;
return;
}
fputc ('N',Profile);
fwrite (&(COLOR_INDEX), sizeof(int),1,Profile);
fwrite (&(GLOBAL_BACKGROUNDCOLOR), sizeof(int),1,Profile);
fwrite (&(GLOBAL_FRONTCOLOR),sizeof(int),1,Profile);
fwrite (&(DRAW_TECH),sizeof(int),1,Profile);
fputc (MAX_LEVEL,Profile);
fwrite (&(LevelProps[0][2]), sizeof(int),1, Profile);
fwrite (USER_LEVEL0,1,9*LEVEL_MAXLEN,Profile);
fwrite (&(LevelProps[1][2]), sizeof(int),1,Profile);
fwrite (USER_LEVEL1,1,9*LEVEL_MAXLEN,Profile);
fwrite (&(LevelProps[2][2]), sizeof(int),1,Profile);
fwrite (USER_LEVEL2,1,9*LEVEL_MAXLEN,Profile);
DrawText (100,300,"saved successfully",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
MENU_SELECTED=1;
fclose (Profile);
}
void MainMenu () {
if (Key==27) GAME_TYPE=-1;
if (MENU_SELECTED==10 && Key==' ') GAME_TYPE=-1;
if (Key=='s') MENU_SELECTED++;
if (Key=='w') MENU_SELECTED--;
if (MENU_SELECTED<0) MENU_SELECTED=10;
if (MENU_SELECTED>10) MENU_SELECTED=0;
if (MENU_SELECTED==0 && Key==' ') {
GAME_TYPE=1;
GLOBAL_CHECKPOINT=0;
return;
}
if (MENU_SELECTED==3 && (Key=='a' || Key=='d')) {
if (GLOBAL_BACKGROUNDCOLOR==0) {
GLOBAL_BACKGROUNDCOLOR=0x00ffffff;
GLOBAL_FRONTCOLOR=0;
} else {
GLOBAL_BACKGROUNDCOLOR=0;
GLOBAL_FRONTCOLOR=0x00ffffff;
}
}
if (MENU_SELECTED==1) {
if (Key=='a' && CURRENT_LEVEL>0) CURRENT_LEVEL--;
if (Key=='d' && CURRENT_LEVEL<MAX_LEVEL) CURRENT_LEVEL++;
HeroSides=LevelProps[CURRENT_LEVEL][2];
}
if (MENU_SELECTED==2) {
if (Key=='a' && COLOR_INDEX>0) COLOR_INDEX--;
if (Key=='d' && COLOR_INDEX<6) COLOR_INDEX++;
HeroColor=RAINBOW_TABLE [COLOR_INDEX][0];
GLOBAL_BLOCKCOLOR=RAINBOW_TABLE [COLOR_INDEX][1];
GLOBAL_BATUTCOLOR=RAINBOW_TABLE [COLOR_INDEX][2];
GLOBAL_PITCOLOR=RAINBOW_TABLE [COLOR_INDEX][3];
GLOBAL_FLAGCOLOR=RAINBOW_TABLE [COLOR_INDEX][4];
}
if (MENU_SELECTED==7 && (Key=='a' || Key=='d')) {
if (SAVE_FOLDER_TYPE==0) {
SAVE_FOLDER_TYPE=1;
} else {
SAVE_FOLDER_TYPE=0;
}
}
if (MENU_SELECTED==8 && (Key=='a' || Key=='d')) {
int i=0;
int j=0;
for (i=0; i<Width; i++) {
for (j=0; j<Height; j++) {
BufferDraw[i][j]=GLOBAL_BACKGROUNDCOLOR;
}
}
Update();
if (DRAW_TECH==0) {
DRAW_TECH=1;
} else {
DRAW_TECH=0;
}
Update();
}
if (MENU_SELECTED==4 && Key==' ') LoadData();
if (MENU_SELECTED==5 && Key==' ') SaveData();
if (MENU_SELECTED==6 && Key==' ') {
if (CURRENT_LEVEL>=3) {
DrawText (300,300,"error",GLOBAL_FRONTCOLOR);
DrawText (30,320,"(choose level 0/1/2 to edit them)",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
MENU_SELECTED=1;
} else {
GAME_TYPE=3;
Panel=1;
}
}
if (Key=='f' && CURRENT_LEVEL<3) {
GAME_TYPE=3;
Panel=1;
}
if (MENU_SELECTED==9 && Key==' ') GAME_TYPE=2;
DrawTitle (60,100,GLOBAL_FRONTCOLOR);
DrawText (100,300,"start game",GLOBAL_FRONTCOLOR);
DrawText (100,320,"choose level < >",GLOBAL_FRONTCOLOR);
IntToStr(CURRENT_LEVEL,NUMBER);
DrawText (345,320,NUMBER,GLOBAL_FRONTCOLOR);
DrawText (100,340,"hero color < >",GLOBAL_FRONTCOLOR);
DrawText (330, 340, RAINBOW_NAME [COLOR_INDEX], GLOBAL_FRONTCOLOR);
DrawText (100,360,"background color < >",GLOBAL_FRONTCOLOR);
if (GLOBAL_BACKGROUNDCOLOR==0) {
DrawText (430,360,"black",GLOBAL_FRONTCOLOR);
} else {
DrawText (430,360,"white",GLOBAL_FRONTCOLOR);
}
DrawText (100,400,"load game",GLOBAL_FRONTCOLOR);
DrawText (100,420,"save game",GLOBAL_FRONTCOLOR);
DrawText (100,440,"level editor",GLOBAL_FRONTCOLOR);
DrawText (100,460,"saveload folder < >",GLOBAL_FRONTCOLOR);
if (SAVE_FOLDER_TYPE==0) {
DrawText (400,460,"local",GLOBAL_FRONTCOLOR);
} else {
DrawText (400,460,"usbhd0/1/",GLOBAL_FRONTCOLOR);
}
DrawText (100,480,"redraw technology < >",GLOBAL_FRONTCOLOR);
if (DRAW_TECH==0) {
DrawText (450,480,"frame",GLOBAL_FRONTCOLOR);
} else {
DrawText (450,480,"lines",GLOBAL_FRONTCOLOR);
}
DrawText (100,520,"help",GLOBAL_FRONTCOLOR);
DrawText (100,540,"quit",GLOBAL_FRONTCOLOR);
DrawText (20,580,"developed by e_shi games 2014",GLOBAL_FRONTCOLOR);
if (MENU_SELECTED==0) DrawText (100,300,"start game",HeroColor);
if (MENU_SELECTED==1) DrawText (100,320,"choose level < >",HeroColor);
if (MENU_SELECTED==2) DrawText (100,340,"hero color < >",HeroColor);
if (MENU_SELECTED==3) DrawText (100,360,"background color < >",HeroColor);
if (MENU_SELECTED==4) DrawText (100,400,"load game",HeroColor);
if (MENU_SELECTED==5) DrawText (100,420,"save game",HeroColor);
if (MENU_SELECTED==6) DrawText (100,440,"level editor",HeroColor);
if (MENU_SELECTED==7) DrawText (100,460,"saveload folder < >",HeroColor);
if (MENU_SELECTED==8) DrawText (100,480,"redraw technology < >",HeroColor);
if (MENU_SELECTED==9) DrawText (100,520,"help",HeroColor);
if (MENU_SELECTED==10) DrawText (100,540,"quit",HeroColor);
}
void GamePlay () {
DrawLine (0,500,800,500,GLOBAL_FRONTCOLOR);
if (Objects==0 || DataBase[Objects-1][1]<=Width-40) {
ReadLevel(CURRENT_LEVEL);
}
if (HeroIsDead==0) {
if (isRestart==1) {
HeroAngle=(HeroAngle+10)%360;
HeroIsDead=CheckCollision();
HeroY+=HeroFly;
DrawHero (125,HeroY, HeroSides, HeroAngle, HeroColor);
} else {
DrawHero (125,HeroY,HeroSides,HeroAngle,GLOBAL_FRONTCOLOR);
}
if (TO_NEXT_LEVEL>0) {
DrawText (Width-TO_NEXT_LEVEL,300,"jump to start new level",GLOBAL_FRONTCOLOR);
if (TO_NEXT_LEVEL<500) {
TO_NEXT_LEVEL+=2;
} else {
if (Key==' ' && TO_NEXT_LEVEL<=504) {
CURRENT_LEVEL++;
HeroSides=CURRENT_LEVEL;
if (CURRENT_LEVEL>MAX_LEVEL) MAX_LEVEL=CURRENT_LEVEL;
GLOBAL_CHECKPOINT=0;
TO_NEXT_LEVEL=505;
}
if (TO_NEXT_LEVEL>=505) {
TO_NEXT_LEVEL+=2;
if (TO_NEXT_LEVEL>1000) TO_NEXT_LEVEL=0;
}
}
}
} else {
GLOBAL_SPEED=0;
DeltaSpeed=0;
TO_NEXT_LEVEL=0;
HeroIsDead++;
DrawPew (125,HeroY,HeroIsDead,HeroColor);
if (HeroIsDead>100) {
ResetLevel(CURRENT_LEVEL);
if (GLOBAL_CHECKPOINT==0) {
isRestart=1;
HeroY=100;
} else {
isRestart=0;
HeroY=SPAWN_Y+41-DeltaH[HeroSides];
if (HeroSides>7) HeroY-=22;
}
HeroIsDead=0;
HeroFly=0;
if (HeroSides%2==0) {
HeroAngle=360/(HeroSides*2);
} else {
HeroAngle=0;
}
}
}
if (Key=='f'&& CURRENT_LEVEL<3) {
int i=0;
Objects=0;
for (i=0; i<11; i++) LevelProps[i][0]=0;
isRestart=1;
HeroIsDead=0;
HeroY=100;
HeroFly=1;
TO_NEXT_LEVEL=0;
GAME_TYPE=3;
Panel=1;
}
if (Key==27) {
GLOBAL_CHECKPOINT=0;
int i=0;
for (i=0; i<11; i++) ResetLevel (i);
isRestart=1;
HeroIsDead=0;
HeroY=100;
HeroFly=1;
TO_NEXT_LEVEL=0;
if (CURRENT_LEVEL<3) {
GAME_TYPE=3;
Panel=1;
Key=' ';
} else {
GAME_TYPE=0;
}
}
}
void ShowHelp() {
DrawText (5,10,"controls",HeroColor);
DrawText (5,30,"w/a/s/d_choose in menu/editor",GLOBAL_FRONTCOLOR);
DrawText (5,50,"space_select/jump",GLOBAL_FRONTCOLOR);
DrawText (5,70,"escape_return to menu/exit",GLOBAL_FRONTCOLOR);
DrawText (5,100,"level editor notes",HeroColor);
DrawText (5,120,"press e to switch grid/tools panel",GLOBAL_FRONTCOLOR);
DrawText (5,140,"press q to switch grid/properties",GLOBAL_FRONTCOLOR);
DrawText (5,160,"select save game to save all levels",GLOBAL_FRONTCOLOR);
DrawText (5,180,"select load game to load all levels",GLOBAL_FRONTCOLOR);
DrawText (5,200,"select level 0/1/2 to play/edit",GLOBAL_FRONTCOLOR);
DrawText (5,220,"use f to go to level editor quickly",GLOBAL_FRONTCOLOR);
DrawText (5,240+20,"use start column to test level from",GLOBAL_FRONTCOLOR);
DrawText (5,260+20,"desired place (note _ you can test",GLOBAL_FRONTCOLOR);
DrawText (5,280+20,"level from column which contains",GLOBAL_FRONTCOLOR);
DrawText (5,300+20,"checkpoint)",GLOBAL_FRONTCOLOR);
DrawText (5,360,"redraw technology notes",HeroColor);
DrawText (5,380,"lines tech works faster but",GLOBAL_FRONTCOLOR);
DrawText (5,400,"sometimes it can be unstable",GLOBAL_FRONTCOLOR);
DrawText (5,420,"frame tech works slower but stable",GLOBAL_FRONTCOLOR);
if (Key=='f') {
GAME_TYPE=3;
Panel=1;
}
if (Key==27) GAME_TYPE=0;
}
void SaveArray() {
FILE *ArrTxt;
if (SAVE_FOLDER_TYPE==1) {
ArrTxt=fopen ("/usbhd0/1/LEVEL2D.txt","wb");
} else {
ArrTxt=fopen ("LEVEL2D.txt","wb");
}
if (ArrTxt==NULL) {
DrawText (100,300,"error (cannot save data)",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
Panel=1;
return;
}
char StringLevel[3*9*LEVEL_MAXLEN]="unsigned char NEW_LEVEL[9][LEVEL_MAXLEN]=\n{";
int CurCharIndex=43;
int i=0;
int j=0;
for (i=0;i<9;i++) {
StringLevel[CurCharIndex]='{';
CurCharIndex++;
for (j=0; j<LEVEL_MAXLEN; j++) {
StringLevel[CurCharIndex]= *(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+j)+48;
CurCharIndex++;
if (j<LEVEL_MAXLEN-1) {
StringLevel[CurCharIndex]=',';
CurCharIndex++;
}
}
StringLevel[CurCharIndex]='}';
CurCharIndex++;
if (i<8) {
StringLevel[CurCharIndex]=',';
CurCharIndex++;
}
StringLevel[CurCharIndex]='\n';
CurCharIndex++;
}
StringLevel[CurCharIndex]='}';
CurCharIndex++;
StringLevel[CurCharIndex]=';';
CurCharIndex++;
StringLevel[CurCharIndex]='\0';
fwrite (StringLevel,1,CurCharIndex,ArrTxt);
fclose (ArrTxt);
}
void LevelEditor () {
int i=0;
int j=0;
if (Panel==0) {
if (Key=='d' && Tile_X<399) Tile_X++;
if (Key=='a' && Tile_X>0) Tile_X--;
if (Key=='s' && Tile_Y<8) Tile_Y++;
if (Key=='w' && Tile_Y>0) Tile_Y--;
if (Key==' ') {
if (Tile_Type==5) {
for (i=0; i<LEVEL_MAXLEN; i++) if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)==5) *(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)=0;
*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X)=5;
} else {
*(Levels[CURRENT_LEVEL]+Tile_Y*LEVEL_MAXLEN+Tile_X)=Tile_Type;
}
}
}
if (Panel==1) {
if (Key=='s' && Tile_Type<5) Tile_Type++;
if (Key=='w' && Tile_Type>0) Tile_Type--;
}
if (Panel==2) {
if (Key=='s' && Q_SELECTED<5) Q_SELECTED++;
if (Key=='w' && Q_SELECTED>0) Q_SELECTED--;
if (Key==' ' && Q_SELECTED==0) {
GAME_TYPE=1;
if (GLOBAL_CHECKPOINT>0) {
int isCheck=0;
for (i=0;i<9; i++) {
int CurBlock=*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+GLOBAL_CHECKPOINT);
if (CurBlock==4) {
SPAWN_Y=(i+1)*43+41+70-DeltaH[HeroSides];
isCheck=1;
break;
}
}
if (isCheck==0) {
DrawText (100,300,"error (checkpoint not found)",GLOBAL_FRONTCOLOR);
Update();
_ksys_delay(200);
GAME_TYPE=3;
Panel=1;
return;
}
ResetLevel(CURRENT_LEVEL);
isRestart=0;
HeroIsDead=0;
HeroFly=0;
HeroY=SPAWN_Y;
if (HeroSides>7) HeroY-=22;
if (HeroSides%2==0) {
HeroAngle=360/(HeroSides*2);
} else {
HeroAngle=0;
}
}
}
if (Q_SELECTED==1) {
if (Key=='d' && GLOBAL_CHECKPOINT<399) GLOBAL_CHECKPOINT++;
if (Key=='a' && GLOBAL_CHECKPOINT>0) GLOBAL_CHECKPOINT--;
}
if (Key==' ' && Q_SELECTED==2) {
for (i=0; i<9; i++) {
for (j=0; j<LEVEL_MAXLEN; j++) {
*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+j)=0;
}
}
}
if (Key==' ' && Q_SELECTED==3) SaveArray();
if (Q_SELECTED==4) {
if (Key=='a' && LevelProps[CURRENT_LEVEL][2]>3) LevelProps[CURRENT_LEVEL][2]--;
if (Key=='d' && LevelProps[CURRENT_LEVEL][2]<10) LevelProps[CURRENT_LEVEL][2]++;
HeroSides=LevelProps[CURRENT_LEVEL][2];
}
if (Key==' ' && Q_SELECTED==5) GAME_TYPE=0;
}
if (Key=='e') {
if (Panel==0) {
Panel=1;
} else {
Panel=0;
}
}
if (Key=='q') {
if (Panel==0) {
Panel=2;
} else {
Panel=0;
}
}
//Draw grid
for (i=0; i<=10; i++) {
DrawLine (43*i,0,43*i,43*9,GLOBAL_FRONTCOLOR);
}
for (i=0; i<=9; i++) {
DrawLine (0,43*i,430,43*i,GLOBAL_FRONTCOLOR);
}
//Draw panel
DrawText (450,10,"e_tools",GLOBAL_FRONTCOLOR);
IntToStr (Tile_X,NUMBER);
DrawText (450,30,"(",GLOBAL_FRONTCOLOR);
DrawText (470,30,NUMBER,GLOBAL_FRONTCOLOR);
DrawText (530,30,"/",GLOBAL_FRONTCOLOR);
IntToStr (Tile_Y,NUMBER);
DrawText (550,30,NUMBER,GLOBAL_FRONTCOLOR);
DrawText (570,30,")",GLOBAL_FRONTCOLOR);
DrawLine (480,70,530,70,GLOBAL_FRONTCOLOR);
DrawLine (480,70,480,70+300,GLOBAL_FRONTCOLOR);
DrawLine (530,70,530,70+300,GLOBAL_FRONTCOLOR);
for (i=1;i<=6; i++) DrawLine (480,70+50*i,530,70+50*i,GLOBAL_FRONTCOLOR);
//Empty block
DrawLine (480+4,70+4,480+42,70+42,GLOBAL_FRONTCOLOR);
DrawLine (480+4,70+42,480+42,70+4,GLOBAL_FRONTCOLOR);
DrawBlock (480+4,70+4+50,GLOBAL_FRONTCOLOR);
DrawPit (480+7,70+4+100,GLOBAL_FRONTCOLOR);
DrawBatut (480+4,70+4+150,GLOBAL_FRONTCOLOR);
DrawFlag (480+8,70+4+200,GLOBAL_FRONTCOLOR);
DrawText (480+14,70+14+250,"f",GLOBAL_FRONTCOLOR);
DrawText (450,400,TILENAME [Tile_Type],GLOBAL_FRONTCOLOR);
//Draw properties
DrawText (10,410,"q_properties",GLOBAL_FRONTCOLOR);
DrawText (10,430+20,"test level",GLOBAL_FRONTCOLOR);
DrawText (10,470,"start column < >",GLOBAL_FRONTCOLOR);
IntToStr (GLOBAL_CHECKPOINT,NUMBER);
DrawText (270,470,NUMBER,GLOBAL_FRONTCOLOR);
DrawText (10,490,"reset level",GLOBAL_FRONTCOLOR);
DrawText (10,510,"save as 2d array (for developers)",GLOBAL_FRONTCOLOR);
DrawText (10,530,"hero sides < >",GLOBAL_FRONTCOLOR);
IntToStr (LevelProps[CURRENT_LEVEL][2],NUMBER);
DrawText (230,530,NUMBER,GLOBAL_FRONTCOLOR);
DrawText (10,550,"back to menu",GLOBAL_FRONTCOLOR);
if (Panel==0) {
DrawLine ((Tile_X%10)*43,0,(Tile_X%10)*43,400,HeroColor);
DrawLine ((Tile_X%10)*43+43,0,(Tile_X%10)*43+43,400,HeroColor);
DrawLine (0,(Tile_Y%10)*43,440,(Tile_Y%10)*43,HeroColor);
DrawLine (0,(Tile_Y%10)*43+43,440,(Tile_Y%10)*43+43,HeroColor);
}
if (Panel==1) {
DrawText (450,10,"e_tools",HeroColor);
DrawLine (480,70+Tile_Type*50,530,70+Tile_Type*50,HeroColor);
DrawLine (480,70+Tile_Type*50,480,70+50+Tile_Type*50,HeroColor);
DrawLine (480,70+Tile_Type*50+50,530,70+50+Tile_Type*50,HeroColor);
DrawLine (530,70+Tile_Type*50,530,70+Tile_Type*50+50,HeroColor);
DrawText (450,400,TILENAME [Tile_Type],HeroColor);
}
if (Panel==2) {
DrawText (10,410,"q_properties",HeroColor);
if (Q_SELECTED==0) DrawText (10,450,"test level",HeroColor);
if (Q_SELECTED==1) DrawText (10,470,"start column < >",HeroColor);
if (Q_SELECTED==2) DrawText (10,490,"reset level",HeroColor);
if (Q_SELECTED==3) DrawText (10,510,"save as 2d array (for developers)",HeroColor);
if (Q_SELECTED==4) DrawText (10,530,"hero sides < >",HeroColor);
if (Q_SELECTED==5) DrawText (10,550,"back to menu",HeroColor);
}
for (i=0; i<10; i++) {
for (j=0; j<9; j++) {
int CurBlock=*(Levels[CURRENT_LEVEL]+j*LEVEL_MAXLEN+Tile_X-Tile_X%10+i);
if (CurBlock==1) DrawBlock (43*i,43*j,GLOBAL_BLOCKCOLOR);
if (CurBlock==2) DrawPit (43*i,43*j,GLOBAL_PITCOLOR);
if (CurBlock==3) DrawBatut (43*i,43*j,GLOBAL_BATUTCOLOR);
if (CurBlock==4) DrawFlag (43*i,43*j,GLOBAL_FLAGCOLOR);
}
if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X-Tile_X%10+i)==5) {
for (j=0; j<9;j++) {
DrawText (43*i+10,43*j+10,"f",GLOBAL_FRONTCOLOR);
}
}
}
if (Key==27) {
GAME_TYPE=0;
}
}
void Authors () {
if (THE_END_COUNT>0) THE_END_COUNT--;
DrawText (240,10+THE_END_COUNT,"the end",HeroColor);
DrawText (10,40+THE_END_COUNT,"dev team",HeroColor);
DrawText (10,60+THE_END_COUNT,"game director _ shimanskey eugene",GLOBAL_FRONTCOLOR);
DrawText (10,80+THE_END_COUNT,"level designer _ chuduk alexander", GLOBAL_FRONTCOLOR);
DrawText (10,100+THE_END_COUNT,"programmer _ shimanskey eugene", GLOBAL_FRONTCOLOR);
DrawText (10,120+THE_END_COUNT,"font designer _ chuduk alexander", GLOBAL_FRONTCOLOR);
DrawText (10,170+THE_END_COUNT,"this game is dedicated to our",GLOBAL_FRONTCOLOR);
DrawText (10,190+THE_END_COUNT,"relatives and friends",GLOBAL_FRONTCOLOR);
if (Key==27) {
GAME_TYPE=0;
THE_END_COUNT=600;
}
}
int main(int argc, char **argv) {
_ksys_get_screen_size (&ScreenX, &ScreenY);
OffsetX=ScreenX/2-Width/2;
OffsetY=ScreenY/2-Height/2;
draw_window();
int TIME_START=0;
int TIME_END=0;
int Delta_Hz=0;
TIME_START=_ksys_get_system_clock();
while (!0) {
TIME_END=_ksys_get_system_clock();
if (TIME_START==TIME_END) {
Delta_Hz++;
} else {
OLD_FPS=NEW_FPS;
NEW_FPS=Delta_Hz;
TIME_START=TIME_END;
Delta_Hz=0;
}
_ksys_delay((OLD_FPS+NEW_FPS)/120);
Key=getKey();
if (GAME_TYPE==-1) return 0;
if (GAME_TYPE==0) MainMenu ();
if (GAME_TYPE==1) GamePlay ();
if (GAME_TYPE==2) ShowHelp ();
if (GAME_TYPE==3) LevelEditor();
if (GAME_TYPE==4) Authors();
Update();
}
}

View File

@ -0,0 +1,234 @@
void draw_window() {
_ksys_window_redraw(1);
_ksys_draw_window(0, 0, ScreenX, ScreenY, 0, 0, 0, 0, 0);
_ksys_window_redraw(2);
}
void DrawLine(int x0, int y0, int x1, int y1, int color) {
int Temp = 0;
int x=0;
int y=0;
//cases when line is out of screen
if (y0 < 0 && y1 < 0) return;
if (y0 >Height - 1 && y1>Height - 1) return;
if (x0 < 0 && x1 < 0) return;
if (x0>Width - 1 && x1>Width - 1) return;
if ((x1 - x0) == 0) {
if (y1 == min(y0, y1)) {
Temp = y1;
y1 = y0;
y0 = Temp;
}
//correcting borders
if (y0 < 0) y0 = 0;
if (y1>Height - 1) y1 = Height - 1;
for (y = y0; y <= y1; y++) {
BufferDraw[x0][y] = color;
if (x0+1<=Width-1) BufferDraw[x0+1][y] = color;
}
}
else if ((y1 - y0) == 0) {
if (x1 == min(x0, x1)) {
Temp = x1;
x1 = x0;
x0 = Temp;
}
if (x0 < 0) x0 = 0;
if (x1>Width - 1) x1 = Width - 1;
for (x = x0; x < x1; x++) {
BufferDraw[x][y0] = color;
if (y0+1<=Height-1) BufferDraw[x][y0+1] = color;
}
}
else {
int PartX=0;
int PartY=0;
int LeftX=min(x0,x1);
if (LeftX<0) LeftX=0;
if (LeftX>Width-1) LeftX=Width-1;
int RightX=max(x0,x1);
if (RightX<0) RightX=0;
if (RightX>Width-1) RightX=Width-1;
int LeftY=min(y0,y1);
if (LeftY<0) LeftY=0;
if (LeftY>Height-1) LeftY=Height-1;
int RightY=max(y0,y1);
if (RightY<0) RightY=0;
if (RightY>Height-1) RightY=Height-1;
if (RightX-LeftX>=RightY-LeftY) {
for (x=LeftX; x<=RightX; x++) {
y=(y1-y0)*(x-x0)/(x1-x0)+y0;
if (y<0) continue;
BufferDraw[x][y]=color;
if (y+1<=Height-1) BufferDraw[x][y+1]=color;
}
} else {
for (y=LeftY; y<=RightY; y++) {
x=(x1-x0)*(y-y0)/(y1-y0)+x0;
if (x<0) continue;
BufferDraw[x][y]=color;
if (x+1<=Width-1) BufferDraw[x+1][y]=color;
}
}
}
}
void DrawText(int x, int y, char Text[] , int color) {
int i=0;
for (i=0; Text[i]!='\0'; i++) {
int j=0;
unsigned char isMatch=0;
for (j=0; Alphabet[j]!='\0'; j++) {
if (Text[i]==Alphabet[j]) {
isMatch=1;
break;
}
}
if (isMatch==0) {
x+=17;
continue;
}
int bitLen=15;
int bitX=0;
int bitY=0;
for (bitX=0; bitX<bitLen; bitX++) {
for (bitY=0; bitY<bitLen; bitY++) {
if (*(AlphaGraphic[j]+bitY*bitLen+bitX)==1) {
if (x+bitX>=0 && x+bitX<=(Width-1) && y+bitY>=0 && y+bitY<=(Height-1)) BufferDraw[x+bitX][y+bitY]=color;
}
}
}
x+=bitLen+2;
}
}
void DrawPit (int x, int y, int color) {
DrawLine (0+x,43+y,15+x,10+y,color);
DrawLine (15+x,10+y,30+x,43+y,color);
DrawLine (0+x,43+y,30+x,43+y,color);
}
void DrawBlock (int x, int y, int color) {
DrawLine (0+x,0+y,40+x,0+y,color);
DrawLine (40+x,0+y,40+x,40+y,color);
DrawLine (40+x,40+y,0+x,40+y,color);
DrawLine (0+x,40+y,0+x,0+y,color);
}
void DrawHero (int x, int y, int Verts, int InitAngle, int color) {
int R=25;
int PointX1=x+FloatToInt(R*sin(InitAngle));
int PointY1=y-FloatToInt(R*cos(InitAngle));
int PointX2=0;
int PointY2=0;
int i=0;
for (i=0; i<Verts; i++) {
InitAngle=(InitAngle+360/Verts)%360;
PointX2=x+FloatToInt(R*sin(InitAngle));
PointY2=y-FloatToInt(R*cos(InitAngle));
DrawLine(PointX1,PointY1,PointX2,PointY2,color);
PointX1=PointX2;
PointY1=PointY2;
CollideVerts[i][0]=PointX1;
CollideVerts[i][1]=PointY1;
}
}
void DrawBatut (int x, int y, int color) {
DrawLine (x,y+20,x+43,y+20,color);
DrawLine (x+43,y+20,x+43,y+43,color);
DrawLine (x+43,y+43,x,y+43,color);
DrawLine (x,y+43,x,y+20,color);
DrawLine (x+10+2,y+35,x+30+2,y+35,color);
DrawLine (x+10+2,y+35,x+20+2,y+27,color);
DrawLine (x+20+2,y+27,x+30+2,y+35,color);
}
void DrawFlag (int x,int y, int color) {
DrawLine (x,y,x,y+43,color);
DrawLine (x,y+43,x+10,y+43,color);
DrawLine (x,y,x+30,y,color);
DrawLine (x+30,y,x+30,y+20,color);
DrawLine (x,y+20,x+30,y+20,color);
DrawText (x+10,y+4,"c",color);
}
void DrawScreen (int x,int y,int xsize, int ysize, void* image) {
asm volatile("int $0x40"::"a"(7),"b"(image),"c"((xsize<<16)+ysize),"d"((x<<16)+y):"memory");
}
void DrawTitle (int x, int y, int color) {
int i=0;
//n
for (i=0; i<=10; i++) {
DrawLine (x,y+i,x+70,y+i,color);
DrawLine (x+i,y,x+i,y+80, color);
DrawLine (x+i+70,y+10,x+i+70,y+80,color);
}
//-
for (i=0; i<=10; i++) {
DrawLine (x+100,y+30+i,x+130,y+30+i,color);
}
//S
for (i=0; i<=10; i++) {
DrawLine (x+160,y+i,x+220, y+i, color);
DrawLine (x+150+i,y+10,x+150+i,y+30,color);
DrawLine (x+150,y+30+i,x+210,y+30+i,color);
DrawLine (x+210+i,y+40,x+210+i,y+70,color);
DrawLine (x+150,y+70+i,x+210,y+70+i,color);
}
//i
for (i=0; i<=10; i++) {
DrawLine (x+240,y+i,x+255,y+i,color);
DrawLine (x+242+i,y+20,x+242+i,y+80,color);
}
//D
for (i=0; i<=10; i++) {
DrawLine (x+270,y+i,x+320,y+i,color);
DrawLine (x+270+i,y,x+270+i,y+80,color);
DrawLine (x+270,y+i+70,x+320,y+70+i,color);
DrawLine (x+320+i,y+10,x+320+i,y+70,color);
}
//E
for (i=0; i<=10; i++) {
DrawLine (x+350,y+i,x+410,y+i, color);
DrawLine (x+350,y+35+i,x+410,y+35+i,color);
DrawLine (x+350,y+70+i,x+410,y+70+i,color);
}
//R
for (i=0; i<=10; i++) {
DrawLine (x+430,y+i,x+480,y+i,color);
DrawLine (x+430+i,y,x+430+i,y+80,color);
DrawLine (x+480+i,y+10,x+480+i,y+40,color);
DrawLine (x+430,y+40+i,x+480,y+40+i,color);
DrawLine (x+480+i,y+52,x+480+i,y+80,color);
}
}
void DrawPew (int x,int y,int frame,int color) {
frame-=15;
DrawLine (x,y-25-frame,x,y-30-frame,color);
DrawLine (x,y+25+frame,x,y+30+frame,color);
DrawLine (x+25+frame,y,x+30+frame,y,color);
DrawLine (x-25-frame,y,x-30-frame,y,color);
DrawLine (x+15+frame,y+15+frame,x+20+frame,y+20+frame,color);
DrawLine (x-15-frame,y-15-frame,x-20-frame,y-20-frame,color);
DrawLine (x-15-frame,y+15+frame,x-20-frame,y+20+frame,color);
DrawLine (x+15+frame,y-15-frame,x+20+frame,y-20-frame,color);
}

View File

@ -0,0 +1,749 @@
char Alphabet[]="0123456789abcdefghijklmnopqrstuvwxyz/()<>_";
unsigned char _emty[15][15]=
{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
unsigned char _0[15][15]=
{{0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
{0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
{1,1,0,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,1,1,0,0,1,1},
{1,1,0,0,0,0,0,0,0,1,1,0,0,1,1},
{1,1,0,0,0,0,1,1,1,0,0,0,0,1,1},
{1,1,0,0,0,0,1,1,1,0,0,0,0,1,1},
{1,1,0,0,0,0,1,1,1,0,0,0,0,1,1},
{1,1,0,0,1,1,0,0,0,0,0,0,0,1,1},
{1,1,0,0,1,1,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,0,1,1},
{0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_1[0][0],&_2[0][0],&_3[0][0],&_4[0][0],&_5[0][0],&_6[0][0],&_7[0][0],&_8[0][0],&_9[0][0],&_a[0][0],&_b[0][0],&_c[0][0],&_d[0][0],&_e[0][0],&_f[0][0],&_g[0][0],&_h[0][0],&_i[0][0],&_j[0][0],&_k[0][0],&_l[0][0],&_m[0][0],&_n[0][0],&_o[0][0],&_p[0][0],&_q[0][0],&_r[0][0],&_s[0][0],&_t[0][0],&_u[0][0],&_v[0][0],&_w[0][0],&_x[0][0],&_y[0][0],&_z[0][0], &_div[0][0],&_open[0][0],&_close[0][0],&_left[0][0],&_right[0][0],&_downspace[0][0]};

View File

@ -0,0 +1,158 @@
void Update() {
int x=0;
int y=0;
int X0=0;
int X1=0;
int CurColor=0;
//LINE DRAW
if (DRAW_TECH==1) {
//Buffer to Buffer
for (x = 0; x < Width; x++) {
for (y = 0; y < Height; y++) {
BufferCarry2[x][y] = BufferDraw[x][y];
}
}
//Convert Analyx to Drawmask Matrix
for (x=0; x<Width; x++) {
for (y=0; y<Height; y++) {
if (Analyx[x][y]==BufferCarry2[x][y]) {
Analyx[x][y]=1;
} else {
Analyx[x][y]=0;
}
}
}
for (x=0; x<Width; x++) {
for (y=0; y<Height; y++) {
if (Analyx[x][y]==1) continue;
CurColor=BufferCarry2[x][y];
//try vertical line
int LineY=y;
while (LineY<Height && BufferCarry2[x][LineY]==CurColor) LineY++;
LineY--;
//try horizontal line
int LineX=x;
while (LineX<Width && BufferCarry2[LineX][y]==CurColor) LineX++;
LineX--;
//chosing the greatest area and draw
int LineYLen=LineY-y+1;
int LineXLen=LineX-x+1;
if (LineXLen>=LineYLen) {
_ksys_line(x+OffsetX,y+OffsetY,LineX+OffsetX,y+OffsetY,CurColor);
int i=0;
for (i=x; i<=LineX; i++) Analyx[i][y]=1;
continue;
}
_ksys_line(x+OffsetX,y+OffsetY,x+OffsetX,LineY+OffsetY,CurColor);
int i=0;
for (i=y; i<=LineY; i++) Analyx[x][i]=1;
}
}
//From Buffer to Analyx and Reset Buffer
for (x = 0; x < Width; x++) {
for (y = 0; y < Height; y++) {
Analyx[x][y]=BufferCarry2[x][y];
BufferDraw[x][y]=GLOBAL_BACKGROUNDCOLOR;
}
}
}
//FULL FRAME DRAW
if (DRAW_TECH==0) {
for (x = 0; x < Width; x++) {
for (y = 0; y < Height; y++) {
BufferCarry[y][x][0] = BufferDraw[x][y]%256;
BufferDraw[x][y]/=256;
BufferCarry[y][x][1]=BufferDraw[x][y]%256;
BufferDraw[x][y]/=256;
BufferCarry[y][x][2]=BufferDraw[x][y]%256;
BufferDraw[x][y]=GLOBAL_BACKGROUNDCOLOR;
}
}
DrawScreen (OffsetX,OffsetY,Width,Height,BufferCarry);
}
//Drawing Level
int i=0;
for (i=0; i<Objects; i++) {
if (DataBase[i][0]==1) {
DrawBlock (DataBase[i][1],DataBase[i][2],GLOBAL_BLOCKCOLOR);
}
if (DataBase[i][0]==2) {
DrawPit (DataBase[i][1],DataBase[i][2],GLOBAL_PITCOLOR);
}
if (DataBase[i][0]==3) {
DrawBatut (DataBase[i][1],DataBase[i][2],GLOBAL_BATUTCOLOR);
}
if (DataBase[i][0]==4) {
DrawFlag (DataBase[i][1],DataBase[i][2],GLOBAL_FLAGCOLOR);
}
DataBase[i][1]-=GLOBAL_SPEED;
if (Objects>0 && DataBase[0][1]<120) isRestart=1;
}
CleanDataBase();
}
void Jump () {
if (Key==' ') HeroFly=-13;
}
char CheckCollision() {
int i=0;
for (i=0; i<Objects; i++) {
if (Abs(DataBase[i][1]-HeroX)>60) continue;
int j=0;
for (j=0;j<HeroSides; j++) {
int PointX=CollideVerts[j][0];
int PointY=CollideVerts[j][1];
if (DataBase[i][0]==2 && PointX>=DataBase[i][1]+6 && PointX<=DataBase[i][1]+30-6 && PointY>=DataBase[i][2]+10 && PointY<=DataBase[i][2]+48) {
return 1;
}
if (DataBase[i][0]==3 && PointX>=DataBase[i][1] && PointX<=DataBase[i][1]+43 && PointY>=DataBase[i][2]+25 && PointY<=DataBase[i][2]+48) {
HeroFly=-25;
return 0;
}
if (DataBase[i][0]==4 && PointX>=DataBase[i][1] && PointX<=DataBase[i][1]+43 && PointY>=DataBase[i][2] && PointY<=DataBase[i][2]+48) {
DrawText (10,510,"checkpoint",GLOBAL_FLAGCOLOR);
GLOBAL_CHECKPOINT=CurrentCheck;
SPAWN_Y=DataBase[i][2];
}
if (DataBase[i][0]==1 && PointX>=DataBase[i][1] && PointX<=DataBase[i][1]+43) {
if (PointY>=DataBase[i][2] && PointY<=DataBase[i][2]+43) {
if (HeroY>=DataBase[i][2] && HeroX<=DataBase[i][1]+6) {
return 1;
}
if (HeroFly<0) {
return 1;
}
//correcting edges
HeroAngle=0;
if (HeroSides%2==0) HeroAngle=360/HeroSides/2;
HeroY=DataBase[i][2]-DeltaH[HeroSides-3];
HeroFly=0;
Jump();
return 0;
} else {
if (DataBase[i][2]-HeroY<HeroFly && HeroFly>0 && DataBase[i][2]-HeroY>0) HeroFly=DataBase[i][2]-HeroY;
}
}
}
}
if (HeroY<500-DeltaH[HeroSides-3]) {
HeroFly++;
} else {
HeroFly=0;
HeroAngle=0;
if (HeroSides%2==0) HeroAngle=360/HeroSides/2;
HeroY=500-DeltaH[HeroSides-3];
Jump();
}
return 0;
}

View File

@ -0,0 +1,236 @@
#define LEVEL_MAXLEN 400
#define CONST_SPEED 5
int DataBase[100][3];
int Objects=0;
unsigned char USER_LEVEL0[9][LEVEL_MAXLEN]={{}};
unsigned char USER_LEVEL1[9][LEVEL_MAXLEN]={{}};
unsigned char USER_LEVEL2[9][LEVEL_MAXLEN]={{}};
//note: [0][0] holds Length high part, [0][1] length lo part, [0][2] holds column to read
unsigned char Lvl03[9][LEVEL_MAXLEN]=
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0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0,1,0,0,1,0,0,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,0,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}
};
//current column, level speed, HeroSides
int LevelProps[11][3]= {{0,5,3},
{0,5,3},
{0,5,3},
{0,5,3},
{0,5,4},
{0,5,5},
{0,5,6},
{0,5,7},
{0,5,8},
{0,5,9},
{0,5,10}};
unsigned char *Levels[11]={&USER_LEVEL0[0][0],&USER_LEVEL1[0][0],&USER_LEVEL2[0][0],&Lvl03[0][0],&Lvl04[0][0],&Lvl05[0][0],&Lvl06[0][0],&Lvl07[0][0],&Lvl08[0][0],&Lvl09[0][0],&Lvl10[0][0]};
void Update();
void CleanDataBase();
void ResetLevel (int level);
void ReadLevel (int level) {
int CurColumn=LevelProps[level][0];
if (CurColumn>=LEVEL_MAXLEN || *(Levels[level]+CurColumn)==5) {
if (CURRENT_LEVEL==10) {
DrawText (40,300,"congratulations you are winner",GLOBAL_FRONTCOLOR);
GLOBAL_CHECKPOINT=0;
ResetLevel (CURRENT_LEVEL);
MAX_LEVEL=10;
HeroY=100;
Update();
_ksys_delay(200);
GAME_TYPE=4;
return;
}
if (CURRENT_LEVEL<3) {
DrawText (200,300,"level completed",GLOBAL_FRONTCOLOR);
GLOBAL_CHECKPOINT=0;
ResetLevel (CURRENT_LEVEL);
HeroY=100;
Update();
_ksys_delay(200);
GAME_TYPE=3;
Panel=1;
return;
} else {
if (TO_NEXT_LEVEL==0) TO_NEXT_LEVEL=1;
return;
}
}
int Cell=0;
GLOBAL_SPEED=LevelProps[level][1];
int CurType=0;
//init
DataBase[Objects][0]=0;
DataBase[Objects][1]=Width;
DataBase[Objects][2]=0;
Objects++;
for (Cell=0; Cell<9; Cell++) {
CurType=*(Levels[level]+Cell*LEVEL_MAXLEN+CurColumn);
if (CurType>0) {
DataBase[Objects][0]=CurType;
DataBase[Objects][1]=Width;
DataBase[Objects][2]=43*(Cell+1)+70;
if (CurType==4) CurrentCheck=CurColumn;
Objects++;
}
}
LevelProps[level][0]++;
}
void ResetLevel (int level) {
Objects=0;
LevelProps[level][0]=GLOBAL_CHECKPOINT;
}
void CleanDataBase () {
int i=0;
for (i=0; i<Objects; i++) {
if (DataBase[i][1]<-50) {
int j=0;
for (j=i+1; j<Objects; j++) {
DataBase[j-1][0]=DataBase[j][0];
DataBase[j-1][1]=DataBase[j][1];
DataBase[j-1][2]=DataBase[j][2];
}
Objects--;
i--;
}
}
}

View File

@ -0,0 +1,83 @@
const float sctable[91]={0.000,0.017,0.035,0.052,0.069,0.087,0.104,0.121,0.139,0.156,0.173,
0.190,0.207,0.225,0.242,0.259,0.275,0.292,0.309,0.325,0.342,
0.358,0.374,0.390,0.406,0.422,0.438,0.454,0.469,0.485,0.500,
0.515,0.530,0.545,0.560,0.573,0.588,0.602,0.616,0.629,0.643,
0.656,0.669,0.682,0.695,0.707,0.719,0.731,0.743,0.754,0.766,
0.777,0.788,0.798,0.809,0.819,0.829,0.838,0.848,0.857,0.866,
0.875,0.883,0.891,0.899,0.906,0.913,0.920,0.927,0.934,0.939,
0.945,0.951,0.956,0.961,0.965,0.970,0.974,0.978,0.982,0.985,
0.987,0.990,0.992,0.994,0.996,0.997,0.998,0.999,0.999,1.000};
float sin (int angle) {
float res=1;
angle%=360;
if (angle>180) res=-1;
if (angle>=0 && angle<=90) return (res*sctable[angle]);
if (angle>90 && angle<=180) return (res*sctable[180-angle]);
if (angle>180 && angle<=270) return (res*sctable[angle-180]);
if (angle>270) return (res*sctable[360-angle]);
return res;
}
float cos (int angle) {
float res=1;
angle%=360;
if (angle>90 && angle<270) res=-1;
if (angle>=0 && angle<=90) return (res*sctable[90-angle]);
if (angle>90 && angle<=180) return (res*sctable[angle-90]);
if (angle>180 && angle<=270) return (res*sctable[90-(angle-180)]);
if (angle>270) return (res*sctable[90-(360-angle)]);
return res;
}
int FloatToInt (float a) {
int sign=1;
int result=0;
if (a<1 && a>(-1)) return 0;
if (a<0) {
sign=-1;
a*=(-1);
}
while (a>=1) {
a--;
result++;
}
return (result*sign);
}
int min (int a, int b) {
if (a<=b) return a;
return b;
}
int max (int a, int b) {
if (a>=b) return a;
return b;
}
void IntToStr (int Value, char Str[]) {
char Stack[100]="";
int StackLen=0;
if (Value==0) {
Str[0]='0';
Str[1]='\0';
return;
}
while (Value!=0) {
Stack[StackLen]=Value%10+48;
Value/=10;
StackLen++;
}
int i=0;
for (i=0; i<StackLen; i++) {
Str[i]=Stack[StackLen-i-1];
}
Str[i]='\0';
}
int Abs (int a) {
if (a<0) return (-1)*a;
return a;
}

View File

@ -0,0 +1,35 @@
/*
** All character classification functions except isascii().
** Integer argument (c) must be in ASCII range (0-127) for
** dependable answers.
*/
#define ALNUM 1
#define ALPHA 2
#define CNTRL 4
#define DIGIT 8
#define GRAPH 16
#define LOWER 32
#define PRINT 64
#define PUNCT 128
#define BLANK 256
#define UPPER 512
#define XDIGIT 1024
extern char _is[128];
#define isalnum(c)(_is[c] & ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
#define isalpha(c)(_is[c] & ALPHA ) /* 'a'-'z', 'A'-'Z' */
#define iscntrl(c)(_is[c] & CNTRL ) /* 0-31, 127 */
#define isdigit(c)(_is[c] & DIGIT ) /* '0'-'9' */
#define isgraph(c)(_is[c] & GRAPH ) /* '!'-'~' */
#define islower(c)(_is[c] & LOWER ) /* 'a'-'z' */
#define isprint(c)(_is[c] & PRINT ) /* ' '-'~' */
#define ispunct(c)(_is[c] & PUNCT ) /* !alnum && !cntrl && !space */
#define isspace(c)(_is[c] & BLANK ) /* HT, LF, VT, FF, CR, ' ' */
#define isupper(c)(_is[c] & UPPER ) /* 'A'-'Z' */
#define isxdigit(c)(_is[c] & XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
#define isascii(c) (!((c)&(~0x7f)))
#define toascii(c) ((c)&0x7f)

View File

@ -0,0 +1,195 @@
#ifndef kolibrisys_h
#define kolibrisys_h
/*
#ifdef GNUC
#define stdcall __stdcall
#define cdecl __cdecl
#else
#define stdcall ((__stdcall))
#define cdecl ((__cdecl))
#endif
*/
//#ifdef GNUC
//#define stdcall __stdcall
//#else
#define cdecl __attribute__ ((cdecl))
#define stdcall __attribute__ ((stdcall))
//#endif
typedef unsigned int dword;
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int fpos_t;
typedef unsigned int size_t;
typedef struct process_table_entry{
int cpu_usage; //+0
int window_pos_info; //+4
short int reserved1; //+8
char name[12]; //+10
int memstart; //+22
int memused; //+26
int pid; //+30
int winx_start; //+34
int winy_start; //+38
int winx_size; //+42
int winy_size; //+46
short int slot_info; //+50
short int reserved2; //+52
int clientx; //+54
int clienty; //+58
int clientwidth; //+62
int clientheight; //+66
unsigned char window_state;//+70
char reserved3[1024-71]; //+71
}__attribute__((packed));
//-----------------------------------------------------------------------------------
//------------------------KolibriOS system acces to files----------------------------
//-----------------------------------------------------------------------------------
extern dword stdcall _ksys_get_filesize(char *filename);
extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data);
extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data);
extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data);
//-----------------------------------------------------------------------------------
//----------------------Run program---------------------------------------------------
extern void stdcall _ksys_run_program(char* filename,char* parameters);
//------------------------------------------------------------------------------------
//--------------------Debug output---------------------------------------------------
extern void stdcall _ksys_debug_out(int c);
extern void stdcall debug_out_str(char* str);
//-----------------------------------------------------------------------------------
//--------------------------Mouse state----------------------------------------------
extern int stdcall _ksys_GetMouseXY(void);
extern int stdcall _ksys_GetMouseButtonsState(void);
//-----------------------------------------------------------------------------------
//--------------------------get skin height------------------------------------------
extern int stdcall _ksys_get_skin_height(void);
//-----------------------------------------------------------------------------------
//----------------------------background---------------------------------------------
extern void stdcall _ksys_set_background_size(int xsize,int ysize);
extern void stdcall _ksys_write_background_mem(int pos,int color);
extern void stdcall _ksys_draw_background(void);
extern void stdcall _ksys_set_background_draw_type(int type);
extern void stdcall _ksys_background_blockmove(void* src,int bgr_pos, int count);
//-----------------------------------------------------------------------------------
//----------------------------functionf for draw window,lines.bar,etc.---------------
extern void stdcall _ksys_draw_window(int xcoord,int ycoord, int xsize,
int ysize,int workcolor,int type,
int captioncolor,int windowtype,int bordercolor);
extern void stdcall _ksys_window_redraw(int status);
extern int stdcall _ksys_putpixel(int x,int y,int color);
extern void stdcall _ksys_draw_bar(int x, int y, int xsize, int ysize, int color);
extern void stdcall _ksys_line(int x1,int y1,int x2,int y2,int color);
extern void stdcall _ksys_putimage(int x, int y, int xsize, int ysize, void* image);
//-----------------------------------------------------------------------------------
//--------------------------write text(system fonts 6x9)-----------------------------
extern void stdcall _ksys_write_text(int x,int y,int color,char* text,int len);
//-----------------------------------------------------------------------------------
//------------------ get screen size and bytes per pixel---------------------------
extern int stdcall _ksys_get_screen_size(int* x,int* y);
extern void stdcall _ksys_dga_get_resolution(int* xres, int* yres, int* bpp, int* bpscan);
//-----------------------------------------------------------------------------------
//-------------------------------craete thread---------------------------------------
extern void* stdcall _ksys_start_thread(void (* func_ptr)(void),int stack_size,int* pid);
//-----------------------------------------------------------------------------------
//------------------system button(Old function. Better use libGUI functions.)--------
extern void stdcall _ksys_make_button(int x, int y, int xsize, int ysize, int id, int color);
extern int stdcall _ksys_get_button_id(void); //get state of system button
//------------------------------------------------------------------------------------
//----------------------system clock(in 1/100 sec.) and date--------------------------
extern int stdcall _ksys_get_system_clock(void);
extern int stdcall _ksys_get_date(void);
//------------------------------------------------------------------------------------
//-------------------------system delay(in 1/100 sec.)-------------------------------
extern void stdcall _ksys_delay(int m);
//-----------------------------------------------------------------------------------
//------------------------system events----------------------------------------------
extern int stdcall _ksys_wait_for_event_infinite(void);
extern int stdcall _ksys_check_for_event(void);
extern int stdcall _ksys_wait_for_event(int time);
extern void stdcall _ksys_set_wanted_events(int ev);
//-----------------------------------------------------------------------------------
//----------------------------system exit program------------------------------------
extern void stdcall _ksys_exit(void);
//-----------------------------------------------------------------------------------
//-----------------------------system IPC send message-------------------------------
extern void stdcall _ksys_send_message(int pid, void* msg, int size);
//-----------------------------------------------------------------------------------
//---------------------------system work with IRQ from user mode---------------------
extern void stdcall _ksys_define_receive_area(void* area, int size);
extern int stdcall _ksys_get_irq_owner(int irq);
extern int stdcall _ksys_get_data_read_by_irq(int irq, int* size, void* data);
extern int stdcall _ksys_send_data_to_device(int port, unsigned char val);
extern int stdcall _ksys_receive_data_from_device(int port,unsigned char* data);
extern void stdcall _ksys_program_irq(void* intrtable, int irq);
extern void stdcall _ksys_reserve_irq(int irq);
extern void stdcall _ksys_free_irq(int irq);
//----------------------------------------------------------------------------------
//----------------------------system reserve diapason of ports----------------------
extern int stdcall _ksys_reserve_port_area(int start,int end);
extern int stdcall _ksys_free_port_area(int start,int end);
//----------------------------------------------------------------------------------
//-------------functions get key and set keyboard mode------------------------------
extern int stdcall _ksys_get_key(void);
extern void stdcall _ksys_set_keyboard_mode(int mode);
//----------------------------------------------------------------------------------
//--------------simple work with MPU401 sound device---------------------------------
extern void stdcall _ksys_midi_reset(void);
extern void stdcall _ksys_midi_send(int data);
//-----------------------------------------------------------------------------------
//--------------------------acces to PCI BUS from user mode---------------------------
extern int stdcall _ksys_get_pci_version(void);
extern int stdcall _ksys_get_last_pci_bus(void);
extern int stdcall _ksys_get_pci_access_mechanism(void);
extern int stdcall _ksys_pci_read_config_byte(int bus,int dev,int fn,int reg);
extern int stdcall _ksys_pci_read_config_word(int bus,int dev,int fn,int reg);
extern int stdcall _ksys_pci_read_config_dword(int bus,int dev,int fn,int reg);
extern int stdcall _ksys_pci_write_config_byte(int bus,int dev,int fn,int reg,int value);
extern int stdcall _ksys_pci_write_config_word(int bus,int dev,int fn,int reg,int value);
extern int stdcall _ksys_pci_write_config_value(int bus,int dev,int fn,int reg,int value);
//--------------------------------------------------------------------------------------
//------------------------Process information--------------------------------------
extern int stdcall _ksys_get_process_table(struct process_table_entry *proctab,int pid); //if pid=-1 than get info about him.
//---------------------------------------------------------------------------------
//-----------------Old functions for work with sound(Sound Blaster only).---------
extern void stdcall _ksys_sound_load_block(void* blockptr);
extern void stdcall _ksys_sound_play_block(void);
extern void stdcall _ksys_sound_set_channels(int channels);
extern void stdcall _ksys_sound_set_data_size(int size);
extern void stdcall _ksys_sound_set_frequency(int frequency);
//--------------------------------------------------------------------------------
//------------------------------system speaker(integrated speaker)----------------
extern void stdcall _ksys_sound_speaker_play(void* data);
//--------------------------------------------------------------------------------
//------------------function for work with Dinamic Link Librarys(DLL)--------------
extern dword* stdcall _ksys_cofflib_load(char* name);
extern char* stdcall _ksys_cofflib_getproc(void* exp,char* sz_name);
//---------------------------------------------------------------------------------
#endif

View File

@ -0,0 +1,179 @@
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
extern int stdcall integer(float number);
extern double acos(double _x);
extern double asin(double _x);
extern double atan(double _x);
extern double atan2(double _y, double _x);
extern double ceil(double _x);
extern double cos(double _x);
extern double cosh(double _x);
extern double exp(double _x);
extern double fabs(double _x);
extern double floor(double _x);
extern double fmod(double _x, double _y);
extern double frexp(double _x, int *_pexp);
extern double ldexp(double _x, int _exp);
extern double log(double _y);
extern double log10(double _x);
extern double modf(double _x, double *_pint);
extern double pow(double _x, double _y);
extern double sin(double _x);
extern double sinh(double _x);
extern double sqrt(double _x);
extern double tan(double _x);
extern double tanh(double _x);
//#ifndef __STRICT_ANSI__
//#ifndef _POSIX_SOURCE
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
#define M_LN2 0.69314718055994530942
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440
#define PI M_PI
#define PI2 M_PI_2
extern double acosh(double);
extern double asinh(double);
extern double atanh(double);
extern double cbrt(double);
extern double exp10(double _x);
extern double exp2(double _x);
extern double expm1(double);
extern double hypot(double, double);
extern double log1p(double);
extern double log2(double _x);
extern long double modfl(long double _x, long double *_pint);
extern double pow10(double _x);
extern double pow2(double _x);
extern double powi(double, int);
extern void sincos(double *, double *, double);
/* These are in libm.a (Cygnus). You must link -lm to get these */
/* See libm/math.h for comments */
/*
#ifndef __cplusplus
struct exception {
int type;
const char *name;
double arg1;
double arg2;
double retval;
int err;
};
#endif
*/
extern double erf(double);
extern double erfc(double);
extern double gamma(double);
extern int isinf(double);
extern int isnan(double);
extern int finite(double);
extern double j0(double);
extern double j1(double);
extern double jn(int, double);
extern double lgamma(double);
extern double nan(void);
extern double y0(double);
extern double y1(double);
extern double yn(int, double);
extern double logb(double);
extern double nextafter(double, double);
extern double remainder(double, double);
extern double scalb(double, double);
//#ifndef __cplusplus
//extern int matherr(struct exception *);
//#endif
extern double significand(double);
extern double copysign(double, double);
extern int ilogb(double);
extern double rint(double);
extern double scalbn(double, int);
extern double drem(double, double);
extern double gamma_r(double, int *);
extern double lgamma_r(double, int *);
extern float acosf(float);
extern float asinf(float);
extern float atanf(float);
extern float atan2f(float, float);
extern float cosf(float);
extern float sinf(float);
extern float tanf(float);
extern float coshf(float);
extern float sinhf(float);
extern float tanhf(float);
extern float expf(float);
extern float frexpf(float, int *);
extern float ldexpf(float, int);
extern float logf(float);
extern float log10f(float);
extern float modff(float, float *);
extern float powf(float, float);
extern float sqrtf(float);
extern float ceilf(float);
extern float fabsf(float);
extern float floorf(float);
extern float fmodf(float, float);
extern float erff(float);
extern float erfcf(float);
extern float gammaf(float);
extern float hypotf(float, float);
extern int isinff(float);
extern int isnanf(float);
extern int finitef(float);
extern float j0f(float);
extern float j1f(float);
extern float jnf(int, float);
extern float lgammaf(float);
extern float nanf(void);
extern float y0f(float);
extern float y1f(float);
extern float ynf(int, float);
extern float acoshf(float);
extern float asinhf(float);
extern float atanhf(float);
extern float cbrtf(float);
extern float logbf(float);
extern float nextafterf(float, float);
extern float remainderf(float, float);
extern float scalbf(float, float);
extern float significandf(float);
extern float copysignf(float, float);
extern int ilogbf(float);
extern float rintf(float);
extern float scalbnf(float, int);
extern float dremf(float, float);
extern float expm1f(float);
extern float log1pf(float);
extern float gammaf_r(float, int *);
extern float lgammaf_r(float, int *);
//#endif /* !_POSIX_SOURCE */
//#endif /* !__STRICT_ANSI__ */
//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
//#ifndef __dj_ENFORCE_FUNCTION_CALLS
//#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
//#ifdef __cplusplus
//}
//#endif
//#endif /* _USE_LIBM_MATH_H */
//#endif /* !__dj_include_math_h_ */

View File

@ -0,0 +1,57 @@
#ifndef stdio_h
#define stdio_h
#include "kolibrisys.h"
typedef char *va_list;
#define _roundsize(n) ( (sizeof(n) + 3) & ~3 )
#define va_start(ap,v) (ap = (va_list)&v+_roundsize(v))
#define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) )
#define va_end(ap) (ap = (va_list)0)
#define NULL ((void*)0)
//extern int stdcall format_print(char *dest, size_t maxlen, const char *fmt0, va_list argp);
typedef struct {
char* buffer;
dword buffersize;
dword filesize;
dword filepos;
char* filename;
int mode;
} FILE;
#define FILE_OPEN_READ 0
#define FILE_OPEN_WRITE 1
#define FILE_OPEN_APPEND 2
#define FILE_OPEN_TEXT 4
#define FILE_OPEN_PLUS 8
#define EOF -1
extern FILE* fopen(const char* filename, const char *mode);
extern void fclose(FILE* file);
extern int feof(FILE* file);
extern int fflush(FILE* file);
extern int fgetc(FILE* file);
extern int fgetpos(FILE* file,fpos_t* pos);
extern int fsetpos(FILE* file,const fpos_t* pos);
extern int fputc(int c,FILE* file);
extern int fread(void* buffer,int size,int count,FILE* file);
extern int fwrite(void *buffer,int size,int count,FILE* file);
extern long ftell(FILE* file);
#define SEEK_CUR 0
#define SEEK_END 1
#define SEEK_SET 2
extern int fseek(FILE* file,long offset,int origin);
extern void rewind(FILE* file);
extern int cdecl fprintf(FILE* file, const char* format,...);
extern int fscanf(FILE* file,const char* format,...);
extern int ungetc(int c,FILE* file);
extern int cdecl printf(const char *format,...);
extern int vsnprintf(char *dest, size_t size,const char *format,va_list ap);
extern int cdecl snprintf(char *dest, size_t size, const char *format,...);
extern int cdecl sprintf(char *dest,const char *format,...);
#endif

View File

@ -0,0 +1,24 @@
#ifndef stdlib_h
#define stdlib_h
#include "kolibrisys.h"
#define RAND_MAX 65535
//#define isspace(c) ((c)==' ')
#define abs(i) (((i)<0)?(-(i)):(i))
extern int atoib(char *s,int b);
extern int atoi(char *s);
extern unsigned char tolower(unsigned char c);
extern unsigned char toupper(unsigned char c);
extern void itoab(int n,char* s,int b);
extern void itoa(int n,char* s);
extern void* stdcall malloc(dword size);
extern void stdcall free(void *pointer);
extern void* stdcall realloc(void* pointer,dword size);
extern int rand (void);
extern void srand (unsigned int seed);
#endif

View File

@ -0,0 +1,25 @@
#ifndef string_h
#define string_h
extern void* memchr(const void*,int,int);
extern int memcmp(const void*,const void*,int);
extern void* memcpy(void*,const void*,int);
extern void* memmove(void*,const void*,int);
extern void* memset(void*,int,int);
extern char* strcat(char*,const char*);
extern char* strchr(const char*,int);
extern int strcmp(const char*,const char*);
extern int strcoll(const char*,const char*);
extern char* strcpy(char*,const char*);
extern int strcspn(const char*,const char*);
extern int strlen(const char*);
extern char* strncat(char*,const char*,int);
extern int strncmp(const char*,const char*,int);
extern char* strncpy(char*,const char*,int);
extern char* strpbrk(const char*,const char*);
extern char* strrchr(const char*,int);
extern int strspn(const char*,const char*);
extern char* strstr(const char*,const char*);
extern char* strtok(char*,const char*);
extern int strxfrm(char*,const char*,int);
extern char* strdup(const char*);
#endif

View File

@ -0,0 +1,20 @@
/*OUTPUT_FORMAT("binary")*/
ENTRY(Start)
SECTIONS
{
.text 0x000000:
{
*(.text)
}
.data : {
*(.data)
hEnd = . ;
}
.bss :
{
*(.bss)
}
Memory = . ;
}

View File

@ -0,0 +1,119 @@
format COFF
section '.text' code
include '../../../proc32.inc'
public __ksys_get_filesize
public __ksys_readfile
public __ksys_rewritefile
public __ksys_appendtofile
align 4
proc __ksys_get_filesize stdcall, filename:dword
xor eax,eax
mov ebx,[filename]
mov [fileinfo.subproc],dword 5
mov [fileinfo.offset_l],eax
mov [fileinfo.offset_h],eax
mov [fileinfo.size],eax
mov [fileinfo.data],dword buffer_for_info
mov [fileinfo.letter],al
mov [fileinfo.filename],ebx
mov eax,70
mov ebx,fileinfo
int 0x40
test eax,eax
jnz error_for_file_size
mov eax,[buffer_for_info+32] ;file size
error_for_file_size:
ret
endp
align 4
proc __ksys_readfile stdcall,filename:dword,position:dword,sizeblock:dword,buffer:dword
xor eax,eax
mov ebx,[position]
mov ecx,[sizeblock]
mov edx,[buffer]
mov esi,[filename]
mov [fileinfo.subproc],eax
mov [fileinfo.offset_l],ebx
mov [fileinfo.offset_h],eax
mov [fileinfo.size],ecx
mov [fileinfo.data],edx
mov [fileinfo.letter],al
mov [fileinfo.filename],esi
mov eax,70
mov ebx,fileinfo
int 0x40
ret
endp
align 4
proc __ksys_rewritefile stdcall,filename:dword,sizeblock:dword,data_write:dword
xor eax,eax
mov ebx,[sizeblock]
mov ecx,[data_write]
mov edx,[filename]
mov [fileinfo.subproc],dword 2
mov [fileinfo.offset_l],eax
mov [fileinfo.offset_h],eax
mov [fileinfo.size],ebx
mov [fileinfo.data],ecx
mov [fileinfo.letter],al
mov [fileinfo.filename],edx
mov eax,70
mov ebx,fileinfo
int 0x40
ret
endp
align 4
proc __ksys_appendtofile stdcall,filename:dword,pos:dword,sizeblock:dword,data_append:dword
xor eax,eax
mov ebx,[pos]
mov ecx,[sizeblock]
mov edx,[data_append]
mov esi,[filename]
mov [fileinfo.subproc],dword 3
mov [fileinfo.offset_l],ebx
mov [fileinfo.offset_h],eax
mov [fileinfo.size],ecx
mov [fileinfo.data],edx
mov [fileinfo.letter],al
mov [fileinfo.filename],esi
mov eax,70
mov ebx,fileinfo
int 0x40
ret
endp
struc FILEIO
{
.subproc rd 1
.offset_l rd 1
.offset_h rd 1
.size rd 1
.data rd 1
.letter rb 1
.filename rd 1
}
fileinfo FILEIO
buffer_for_info rd 11

View File

@ -0,0 +1,15 @@
format COFF
include "../../../proc32.inc"
section '.text' code
public __ksys_get_system_clock
align 4
proc __ksys_get_system_clock stdcall
mov eax,3
int 0x40
ret
endp

View File

@ -0,0 +1,11 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_delay,4
;arg1 - time
mov edx,ebx
mov eax,5
mov ebx,[esp+4]
int 0x40
mov ebx,edx
ret 4

View File

@ -0,0 +1,21 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_draw_bar,20
;arg1 - x
;arg2 - y
;arg3 - xsize
;arg4 - ysize
;arg5 - color
push ebx
mov eax,13
mov ebx,[esp+8]
shl ebx,16
mov bx,[esp+16]
mov ecx,[esp+12]
shl ecx,16
mov cx,[esp+20]
mov edx,[esp+24]
int 0x40
pop ebx
ret 20

View File

@ -0,0 +1,34 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_draw_window,36
;arg1 - xcoord
;arg2 - ycoord
;arg3 - xsize
;arg4 - ysize
;arg5 - workcolor
;arg6 - type
;arg7 - captioncolor
;arg8 - windowtype
;arg9 - bordercolor
push ebp
mov ebp,esp
push ebx esi edi
mov ebx,[ebp+8]
shl ebx,16
mov bx,[ebp+16]
mov ecx,[ebp+12]
shl ecx,16
mov cx,[ebp+20]
mov edx,[ebp+28]
shl edx,24
add edx,[ebp+24]
mov esi,[ebp+36]
shl esi,24
add esi,[ebp+32]
mov edi,[ebp+40]
xor eax,eax
int 0x40
pop edi esi ebx
pop ebp
ret 36

View File

@ -0,0 +1,29 @@
format COFF
include "../../../proc32.inc"
section '.text' code
public __ksys_get_key
public __ksys_set_keyboard_mode
align 4
proc __ksys_get_key stdcall
mov eax,2
int 0x40
ret
endp
align 4
proc __ksys_set_keyboard_mode stdcall, mode:dword
mov edx,ebx
mov eax,66
xor ebx,ebx
inc ebx
mov ecx,[mode]
mov ebx,edx
ret
endp

View File

@ -0,0 +1,21 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_line,20
;arg1 - x1
;arg2 - y1
;arg3 - x2
;arg4 - y2
;arg5 - color
push ebx
mov ebx,[esp+8]
shl ebx,16
mov bx,[esp+16]
mov ecx,[esp+12]
shl ecx,16
mov cx,[esp+20]
mov edx,[esp+24]
mov eax,38
int 0x40
pop ebx
ret 20

View File

@ -0,0 +1,38 @@
format COFF
;include "proc32.inc"
section '.text' code
public _malloc
public _free
public _realloc
align 4
_malloc:
mov eax,68
mov ebx,12
mov ecx,[esp+4] ;size
int 0x40
ret 4
align 4
_free:
mov eax,68
mov ebx,13
mov ecx,[esp+4]
int 0x40
ret 4
align 4
_realloc:
mov ebx,20
mov eax,68
mov ecx,[esp+4]
mov edx,[esp+8]
int 0x40
ret 8

View File

@ -0,0 +1,7 @@
macro public_stdcall name,size
{
public name
public name#@#size
name:
name#@#size:
}

View File

@ -0,0 +1,15 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_get_screen_size,8
;arg1 - x
;arg2 - y
mov eax,14
int 0x40
mov ecx,[esp+8]
mov [ecx],ax
mov word [ecx+2],0
shr eax,16
mov ecx,[esp+4]
mov [ecx],eax
ret 8

View File

@ -0,0 +1,11 @@
format COFF
include "public_stdcall.inc"
section '.text' code
public_stdcall __ksys_window_redraw,4
;arg1 - status
mov edx,ebx
mov eax,12
mov ebx,[esp+4]
int 0x40
mov ebx,edx
ret 4

View File

@ -0,0 +1,44 @@
format MS COFF
public Start
public ___path
public _PARAM
public ___main
extrn Memory
extrn hEnd
extrn _main
section ".text" code
db "MENUET01"
dd 1, Start, hEnd, Memory, hStack, _PARAM, ___path
Start:
; èíèöèàëèçàöèÿ êó÷è
mov eax, 68
mov ebx, 11
int 0x40
; âûçîâ ãëàâíîé ïðîöåäóðû
call _main
; çàâåðøåíèå ðàáîòû ïðîãðàììû
mov eax, -1
int 0x40
___main:
ret
section ".bss"
_PARAM:
rb 256
___path:
rb 256
rb 8*1024
hStack:

View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void fclose(FILE* file)
{
free(file->buffer);
free(file);
}

View File

@ -0,0 +1,5 @@
#include <stdio.h>
int feof(FILE* file)
{
return file->filepos>=file->filesize;
}

View File

@ -0,0 +1,7 @@
#include <stdio.h>
int fflush(FILE* file)
{
if ((file->mode & 3)==FILE_OPEN_READ)
return 0;
return(EOF);
}

View File

@ -0,0 +1,22 @@
#include <stdio.h>
int fgetc(FILE* file)
{
dword res;
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
if (file->filepos>=file->filesize)
{
return EOF;
}
else
{
res=_ksys_readfile(file->filename,file->filepos,1,file->buffer);
if (res==0)
{
file->filepos++;
return (int)file->buffer[0];
}
else return(res);
}
}

View File

@ -0,0 +1,6 @@
#include <stdio.h>
int fgetpos(FILE* file,fpos_t* pos)
{
*pos=file->filepos;
return 0;
}

View File

@ -0,0 +1,138 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char __argv;
extern char __path;
const char* getfullpath(const char *path){
int i,j,relpath_pos,localpath_size;
int filename_size;
char local_path;
char *programpath;
char *newpath;
i=0;
local_path=1; //enable local path
while((*(path+i)!='\0') || (*(path+i)!=0))
{
if (*(path+i)=='.')
{
if (*(path+i+1)=='/')
{ //detected relative path
relpath_pos=i+2;
local_path=0;
break;
}
}
if (*(path+i)=='/')
{ //disabple local path
local_path=0;
return(path);
}
i++;
}
filename_size=i;
programpath=&__path;
if (local_path==1)
{
i=0x400;
//find local path of program
while(*(programpath+i)!='/')
{
i--;
}
localpath_size=i;
newpath=malloc(0x400);
//copy local path to the new path
for(i=0;i<=localpath_size;i++)
{
*(newpath+i)=*(programpath+i);
}
//copy filename to the new path
for(i=0;i<filename_size;i++)
{
*(newpath+localpath_size+1+i)=*(path+i);
}
return(newpath);
}
//if we here than path is a relative
i=0x400;
//find local path of program
while(*(programpath+i)!='/')
{
i--;
}
localpath_size=i;
i=0;
//find file name size
while((*(path+relpath_pos+i)!='\0') || (*(path+relpath_pos+i)!=0))
{
i++;
}
filename_size=i;
newpath=malloc(0x400);
//copy local path to the new path
for(i=0;i<=localpath_size;i++)
{
*(newpath+i)=*(programpath+i);
}
//copy filename to the new path
for(i=0;i<filename_size;i++)
{
*(newpath+localpath_size+1+i)=*(path+relpath_pos+i);
}
return(newpath);
}
FILE* fopen(const char* filename, const char *mode)
{
FILE* res;
int imode;
imode=0;
if (*mode=='r')
{
imode=FILE_OPEN_READ;
mode++;
}else if (*mode=='w')
{
imode=FILE_OPEN_WRITE;
mode++;
}else if (*mode=='a')
{
imode=FILE_OPEN_APPEND;
mode++;
}else
return 0;
if (*mode=='t')
{
imode|=FILE_OPEN_TEXT;
mode++;
}else if (*mode=='b')
mode++;
if (*mode=='+')
{
imode|=FILE_OPEN_PLUS;
mode++;
}
if (*mode!=0)
return 0;
res=malloc(sizeof(FILE));
res->buffer=malloc(256);
res->buffersize=256;
res->filesize=0;
res->filepos=0;
res->mode=imode;
res->filename=getfullpath(filename);
if ((imode==FILE_OPEN_READ) || (imode==FILE_OPEN_APPEND))
{
res->filesize=_ksys_get_filesize(res->filename);
}
return res;
}

View File

@ -0,0 +1,35 @@
#include <stdio.h>
int fputc(int c,FILE* file)
{
dword res;
if ((file->mode & 3)==FILE_OPEN_READ) return EOF;
file->buffer[0]=c;
if ((file->mode & 3)==FILE_OPEN_APPEND)
{
file->filepos=file->filesize;
file->filesize++;
res=_ksys_appendtofile(file->filename,file->filepos,1,file->buffer);
if (res!=0) return(res);
file->filepos++;
return(0);
}
if ((file->mode & 3)==FILE_OPEN_WRITE)
{
if (file->filepos==0)
{ //file not craeted
res=_ksys_rewritefile(file->filename,1,file->buffer);
if (res!=0) return(res);
file->filepos++;
return 0;
}
else
{ //file craeted and need append one byte
res=_ksys_appendtofile(file->filename,file->filepos,1,file->buffer);
if (res!=0) return(res);
file->filepos++;
return 0;
}
}
}

View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <kolibrisys.h>
int fread(void *buffer,int size,int count,FILE* file)
{
dword res;
dword fullsize;
if ((file->mode!=FILE_OPEN_READ) || (file->mode==FILE_OPEN_PLUS)) return 0;
fullsize=count*size;
if ((fullsize+file->filepos)>(file->filesize))
{
fullsize=file->filesize-file->filepos;
if (fullsize<=0) return(0);
}
res=_ksys_readfile(file->filename,file->filepos,fullsize,buffer);
if (res==0)
{
file->filepos=file->filepos+fullsize;
fullsize=fullsize/size;
return(fullsize);
}
else return 0;
}

View File

@ -0,0 +1,11 @@
#include <stdio.h>
int fseek(FILE* file,long offset,int origin)
{
if (origin==SEEK_CUR)
offset+=file->filepos;
else if (origin==SEEK_END)
offset+=file->filesize;
else if (origin!=SEEK_SET)
return EOF;
return fsetpos(file,offset);
}

View File

@ -0,0 +1,11 @@
#include <stdio.h>
int fsetpos(FILE* file,const fpos_t * pos)
{
if (*pos>=0)
{
file->filepos=*pos;
return 0;
}
else
return EOF;
}

View File

@ -0,0 +1,5 @@
#include <stdio.h>
long ftell(FILE* file)
{
return file->filepos;
}

View File

@ -0,0 +1,58 @@
#include <stdio.h>
#include <kolibrisys.h>
int fwrite(void *buffer,int size,int count,FILE* file)
{
dword res;
dword fullsize;
if (file->mode==FILE_OPEN_READ) return 0;
if (file->mode==FILE_OPEN_APPEND)
file->filepos=file->filesize;
fullsize=count*size;
if ((file->filesize)<(file->filepos+fullsize)) file->filesize=file->filepos+fullsize;
/*
if (file->mode==FILE_OPEN_APPEND)
{
file->filepos==file->filesize;
res=_ksys_appendtofile(file->filename,file->filepos,fullsize,buffer);
if (res==0)
{
file->filepos+=fullsize;
fullsize=fullsize/size;
return(fullsize);
}
else return(0);
}
*/
if ((file->mode==FILE_OPEN_WRITE) || (file->mode==FILE_OPEN_APPEND))
{
if (file->filepos==0)
{ //file mot craeted yet
res=_ksys_rewritefile(file->filename,fullsize,buffer);
if (res==0)
{
file->filepos+=fullsize;
fullsize=fullsize/count;
return(fullsize);
}
else return(0);
}
else
{
res=_ksys_appendtofile(file->filename,file->filepos,fullsize,buffer);
if (res==0)
{
file->filepos+=fullsize;
fullsize=fullsize/count;
return(fullsize);
}
else return(0);
}
}
else return(0);
}

View File

@ -0,0 +1,5 @@
#include <stdio.h>
void rewind(FILE* file)
{
file->filepos=0;
}