here is my source code:
extern "C" {
#include "fxlib.h"
#include "stdlib.h"
#include "stdio.h"
}
#include "string.h"
//typedef unsigned char byte;
#include "SH3Timers.h"
#include "GaumerieLib\GaumerieLib.h"
////////////////////////////////////////////////////////////////////////////////
//BITMAP scrN[1024] = {0x00};
//BITMAP scrNG[1024] = {0x00};
BITMAP buf1[1024] = {0x00};
BITMAP buf2[1024] = {0x00};
GBitmap2 buffer = {128, 64, buf1, buf2};
BITMAP *screen[] = {buf1,buf2};
////////////////////////////////////////////////////////////////////////////////
//*********************************************************************//
unsigned char ucda1[6] = {0x78,0xac,0xd4,0xac,0xd4,0x78,};
unsigned char ucda2[6] = {0x78,0xfc,0xfc,0xfc,0xfc,0x78,};
GBitmap2 b_da={6,6,ucda1,ucda2};
//*********************************************************************//
unsigned char ucpl1[6] = {0x30,0x48,0x30,0x48,0xcc,0x30,};
unsigned char ucpl2[6] = {0x30,0x48,0x30,0x78,0xfc,0x30,};
GBitmap2 b_pl={6,6,ucpl1,ucpl2};
//*********************************************************************//
unsigned char ucxu1[6] = {0x30,0x48,0xb4,0xb4,0x48,0x30,};
unsigned char ucxu2[6] = {0x0,0x0,0x30,0x30,0x0,0x0,};
GBitmap2 b_xu={6,6,ucxu1,ucxu2};
//*********************************************************************//
unsigned char ucthung1[6] = {0x78,0xe4,0xf4,0xdc,0xfc,0x78,};
unsigned char ucthung2[6] = {0x0,0x0,0x0,0x0,0x0,0x0,};
GBitmap2 b_thung={6,6,ucthung1,ucthung2};
//*********************************************************************//
BITMAP ucphadc2[6] = {0x0,0x78,0x78,0x78,0x78,0x0,};
BITMAP ucphadc1[6] = {0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,};
GBitmap2 b_phadc={6,6,ucphadc1,ucphadc2};
//*********************************************************************//
GBitmap2 b_clr={6,6,ucthung2,ucthung2};
GBitmap2* bitmaps[]={&b_da,&b_xu,&b_thung,&b_phadc,&b_pl,&b_clr};
//*********************************************************************//
#define GetKey IsKeyDown
void CopyToScreen(unsigned char * kd,unsigned char t=IMB_WRITEKIND_OVER)
{
GRAPHDATA d;
DISPGRAPH sss;d.width=128;d.height=64;d.pBitmap=kd;
sss.x=0; sss.y=0; sss.GraphData=d; sss.WriteModify=IMB_WRITEMODIFY_NORMAL; sss.WriteKind=t;
Bdisp_WriteGraph_VRAM(&sss);
}
class SLIPPY_CLASS
{
private:
int lvl,level[10][16],px,py;
public:
virtual signed play();
void dDraw();
int Logo();
void load_level(int lvl),move(int dx,int dy);
void win();
};
const unsigned int LuaFont_offset_table[] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
64, 68, 70, 74, 80, 84, 89, 94, 96, 99, 102, 106, 112, 115, 120, 122,
127, 132, 136, 141, 146, 151, 156, 161, 166, 171, 176, 178, 181, 185, 190, 194,
198, 203, 208, 213, 218, 223, 228, 233, 238, 243, 247, 252, 257, 262, 268, 273,
278, 283, 288, 293, 298, 304, 309, 314, 320, 325, 330, 335, 339, 344, 348, 352,
356, 358, 363, 368, 373, 378, 383, 387, 392, 397, 400, 404, 408, 411, 417, 422,
427, 432, 437, 441, 446, 450, 455, 460, 466, 471, 476, 481, 485, 487, 491, 496,
498, 503, 508, 513, 518, 523, 528, 533, 539, 544, 550, 555, 560, 564, 570, 576,
581, 586, 591, 596, 601, 606, 611, 615, 620, 625, 632, 637, 641, 646, 651, 656,
661, 665, 669, 671, 675, 680, 685, 690, 695, 699, 704, 709, 711, 715, 720, 725,
730, 735, 740, 745, 750, 755, 761, 766, 771, 775, 781, 786, 790, 794, 799, 804,
809, 814, 819, 824, 829, 836, 841, 846, 851, 855, 859, 864, 869, 874, 879, 884,
889, 895, 897, 902, 907, 912, 917, 924, 929, 936, 941, 947, 953, 959, 963, 969,
974, 978, 982, 986, 992, 994, 998, 1002, 1006, 1010, 1013, 1018, 1023, 1028, 1033, 1038,
1043, 1046, 1049, 1052, 1056, 1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, 0x64, 0x48, 0x27, 0x39, 0xce, 0x73, 0x9c, 0xe0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1c, 0x0, 0xc0, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x0, 0x1, 0xc0, 0x4, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x5, 0x74, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x17, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x15, 0x80, 0x94, 0x0, 0x0, 0x0,
0x3, 0x82, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3b, 0xa3, 0x80, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x1b, 0x64, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0,
};
typedef struct
{
unsigned int *offset;
unsigned char *data;
int height;
} Font;
const Font LuaFont = {(unsigned int *)LuaFont_offset_table,(unsigned char *)LuaFont_data_table,8};
int text(int x0,int top=0,int y0=0,int left=127,int bottom=63,unsigned char *s=NULL,int *iii=NULL)
{
int i=0,j,k,x=x0,y=y0,r=0;
for(i=0;i<strlen((char*)s);i++){
if(s[i]=='\n'){x=x0;y+=LuaFont.height;if(y+LuaFont.height>bottom) return r;continue;}
else if(x+LuaFont.offset[s[i]+1]-LuaFont.offset[s[i]]>left) {x=x0;y+=LuaFont.height;if(y+LuaFont.height>bottom) return r;}
for(j=LuaFont.offset[s[i]];j<LuaFont.offset[s[i]+1];j++){
x++;if(x)
for(k=0;k<LuaFont.height;k++)
if(y+k>=top&&y+k<=bottom)if(LuaFont.data[k*139+(j>>3)]&(0x80)>>(j-((j>>3)<<3))) Bdisp_SetPoint_VRAM(x,y+k,1);
}
}
if(y+k<=0)*iii=0;
return r;
}
int SLIPPY_CLASS::Logo(void) {
unsigned char ucLogo[1024] = {
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5f,0xff,0xff,0xff,0xff,0xff,0xfd,0x55,
0x55,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xa8,0x0,0x0,0x0,0x0,0x0,0x6,0xaa,
0xaa,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x58,0xfe,0x7b,0x80,0x0,0x0,0x5,0x55,
0x55,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xe0,0x78,0x0,0x0,0x0,0x6,0xaa,
0xaa,0x55,0x55,0x57,0xf5,0x55,0x55,0x55,0x59,0xfe,0xf7,0x9f,0xcf,0xe7,0x75,0x55,
0x55,0xaa,0xaa,0xaf,0xfa,0xaa,0xaa,0xaa,0xa9,0xfe,0xf7,0xbc,0xde,0x6f,0x76,0xaa,
0xaa,0x55,0x55,0x5f,0xfd,0x55,0x55,0x55,0x59,0xfe,0xf7,0x79,0xdc,0xce,0xe5,0x55,
0x55,0xaa,0xaa,0xbf,0xfe,0xaa,0xaa,0xaa,0xa8,0xd,0xef,0x7f,0xbf,0xcf,0xe6,0xaa,
0xaa,0x55,0x55,0x7f,0xff,0x55,0x55,0x55,0x5b,0xfd,0xef,0x7f,0x3f,0x81,0xe5,0x55,
0x55,0xaa,0xaa,0xff,0xff,0xaa,0xaa,0xaa,0xa8,0x0,0x0,0xf0,0x78,0x1f,0xc6,0xaa,
0xaa,0x55,0x55,0xff,0xff,0xd5,0x55,0x55,0x58,0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0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xe,0x80,0x0,0x3e,0x18,0x0,0x3,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xd,0x80,0x0,0x3f,0xf8,0x0,0x2,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xe,0x40,0x0,0x7f,0xfc,0x0,0xd,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xd,0xbc,0x0,0x7f,0xfc,0x0,0x3a,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xe,0x56,0x0,0xd5,0x56,0x0,0xd5,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf9,0xab,0xff,0xaa,0xab,0xff,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
0xaa,0x55,0x5f,0x55,0x55,0xf5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
0xaa,};
int i=0;
char strhelp[]="\n\n\n\n\n\nSLIPPY\n======\nA puzzle game where you must collect all the coins in each\nlevel.\n Controls:\nMove: Curs/Num\nRestart: Ac\nExit: Exit\nChangeLvl: +/-\n\n======\nAuthor\n======\nvanhoa\n\n=======\nversion\n=======\n1.00\n\n\n(c) vanhoa 2007";
SH3Timer::SetTimerFreq(SH3Timer::TIMER_2, 6000);
SH3Timer::SetCount(SH3Timer::TIMER_2, 0);
SH3Timer::Start(SH3Timer::TIMER_2);
while(GetKey(KEY_CTRL_EXE)||IsKeyDown(KEY_CTRL_EXIT))if(SH3Timer::HasUnderflowed(SH3Timer::TIMER_2)){CopyToScreen(ucLogo);text(52,19,i,122,57,(unsigned char*)strhelp,&i);Bdisp_PutDisp_DD();i--;};
while(!GetKey(KEY_CTRL_EXE)&&!IsKeyDown(KEY_CTRL_EXIT))if(SH3Timer::HasUnderflowed(SH3Timer::TIMER_2)){CopyToScreen(ucLogo);text(52,19,i,122,57,(unsigned char*)strhelp,&i);Bdisp_PutDisp_DD();i--;};
i=0;while(GetKey(KEY_CTRL_EXE)) i=IsKeyDown(KEY_CTRL_EXIT);
SH3Timer::Stop(SH3Timer::TIMER_2);
delete [] ucLogo;
free(strhelp);
return i;
}
void SLIPPY_CLASS::load_level(int lvl){
int i=0,j;
#include "level.h"
// memset(level,5,144*sizeof(int));
for(i=0;i<10;i++) for(j=0;j<16;j++) level[i][j]=5;
i=j=0;
for(j=0;j<117;j++){
if(MapData[lvl][j]==254){i++;if(i>4) break;}
level[(int)(MapData[lvl][j]/16)][MapData[lvl][j]%16]=i;
}
for(i=0;i<10;i++) for(j=0;j<16;j++) if(level[i][j]==4) {px=i;py=j;level[i][j]=5;};
}
int t=0,f=0;int crrbuf=0;
void tmb(){f=t;t=0;};
void SLIPPY_CLASS::dDraw()
{
int i,j;
for(i=0;i<10;i++)
for(j=0;j<16;j++){
DrawBitmap2(bitmaps[level[i][j]],j*6+16,2+i*6,&buffer);
}
DrawBitmap2(bitmaps[4],py*6+16,2+px*6,&buffer);
//DrawBitmap2(&buffer, 0, 0, &screen);
crrbuf^=1;
CopyToScreen(screen[crrbuf]);
if(IsKeyDown(KEY_CTRL_OPTN)) {char s[21];sprintf(s,"%i",f);PrintMini(0,0,(unsigned char*)s,1);}
///
Bdisp_PutDisp_DD();
t++;
}
void SLIPPY_CLASS::win()
{
for(int i=0;i<10;i++) for(int j=0;j<16;j++) if(level[i][j]==1) return;
lvl++; lvl%=25;load_level(lvl);dDraw();
}
void SLIPPY_CLASS::move(int dx,int dy){
int x=(px+dx+10)%10,y=(py+dy+16)%16;
if(level[x][y]==0&&level[x][y]==3) return;
if(level[x][y]==5){px=x;py=y;dDraw();return;}
if(level[x][y]==1){level[x][y]=5;px=x;py=y;dDraw();win();return;}
if(level[x][y]==2){
int i=x,j=y;
while(i+dx>=0&&i+dx<10&&j+dy>=0&&j+dy<16) if(level[i+dx][j+dy]!=5) break; else {level[i][j]=5;i+=dx;j+=dy;level[i][j]=2;dDraw();}
i+=dx;j+=dy;if(i>=0&&i<10&&j>=0&&j<16){if(level[i][j]==3){dDraw();dDraw();dDraw();dDraw();dDraw();level[i-dx][j-dy]=level[i][j]=5;dDraw();}}else level[i-dx][j-dy]=5;
dDraw();
return;
}
}
signed SLIPPY_CLASS::play()
{
if(Logo()) return 0;
lvl=0;
SH3Timer::SetTimerFreq(SH3Timer::TIMER_2, 3000);
SH3Timer::SetCount(SH3Timer::TIMER_2, 0);
SH3Timer::Start(SH3Timer::TIMER_2);
//GrayScales::SetBuffers(screen.tuc_Bmp, screen.tuc_Bmp2);
SetTimer(1,1000,tmb);
load_level(lvl);
dDraw();
while(1){
if(SH3Timer::HasUnderflowed(SH3Timer::TIMER_2)){
///
if(GetKey(KEY_CHAR_PLUS)) {lvl++; lvl%=25;load_level(lvl);dDraw();}
if(GetKey(KEY_CHAR_MINUS)) {lvl+=24;lvl%=25;load_level(lvl);dDraw();}
if(GetKey(KEY_CTRL_AC)) {load_level(lvl);dDraw();}
///
if(GetKey(KEY_CHAR_8)||GetKey(KEY_CTRL_UP)) move(-1,0);
if(GetKey(KEY_CHAR_2)||GetKey(KEY_CTRL_DOWN)) move(1,0);
if(GetKey(KEY_CHAR_4)||GetKey(KEY_CTRL_LEFT)) move(0,-1);
if(GetKey(KEY_CHAR_6)||GetKey(KEY_CTRL_RIGHT)) move(0,1);
}
if(IsKeyDown(KEY_CTRL_EXIT)) break;
crrbuf^=1;CopyToScreen(screen[crrbuf]);
if(IsKeyDown(KEY_CTRL_OPTN)) {char s[21];sprintf(s,"%i",f);PrintMini(0,0,(unsigned char*)s,1);}
///
Bdisp_PutDisp_DD();t++; }
Bdisp_AllClr_VRAM();
SH3Timer::StopAll();
return 0;
}
extern "C" int AddIn_main(int isAppli, unsigned short OptionNum)
{
SLIPPY_CLASS slpcl;
slpcl.play();
return 1;
}
#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
extern "C" int InitializeSystem(int isAppli, unsigned short OptionNum)
{
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}
#pragma section