📄 koulesapp.c
字号:
for (xx = 0; xx < w; xx++)
{
for (yy = 0; yy < h; yy++)
{
if
(x + xx >= 0
&& x + xx < KOULESMAPWIDTH
&& y + yy >= 0
&& y + yy < KOULESMAPHEIGHT
&& koules_bball_bitmap[xx][yy] != 0
)
{
koulesdisplay[(y + yy)*KOULESWINWIDTH+x + xx] = koulespens[koules_bball_bitmap[xx][yy]];
}
}
}
}
void Koules_draw_inspector(int x, int y, int w, int h)
{
int xx, yy;
for (xx = 0; xx < w; xx++)
{
for (yy = 0; yy < h; yy++)
{
if
(x + xx >= 0
&& x + xx < KOULESMAPWIDTH
&& y + yy >= 0
&& y + yy < KOULESMAPHEIGHT
&& koules_inspector_bitmap[xx][yy] != 0
)
{
koulesdisplay[(y + yy)*KOULESWINWIDTH+x + xx] = koulespens[koules_inspector_bitmap[xx][yy]];
}
}
}
}
void Koules_draw_rocket(int x, int y, int w, int h, int which)
{
int xx, yy;
for (xx = 0; xx < w; xx++)
{
for (yy = 0; yy < h; yy++)
{
if
(x + xx >= 0
&& x + xx < KOULESMAPWIDTH
&& y + yy >= 0
&& y + yy < KOULESMAPHEIGHT
&& koules_rocket_bitmap[which][xx][yy] != 0
)
{
koulesdisplay[(y + yy)*KOULESWINWIDTH+x + xx] = koulespens[koules_rocket_bitmap[which][xx][yy]];
}
}
}
}
void Koules_draw_lunatic(int x, int y, int w, int h)
{
int xx, yy;
for (xx = 0; xx < w; xx++)
{
for (yy = 0; yy < h; yy++)
{
if
(x + xx >= 0
&& x + xx < KOULESMAPWIDTH
&& y + yy >= 0
&& y + yy < KOULESMAPHEIGHT
&& koules_lunatic_bitmap[xx][yy] != 0
)
{
koulesdisplay[(y + yy)*KOULESWINWIDTH+x + xx] = koulespens[koules_lunatic_bitmap[xx][yy]];
}
}
}
}
void Koules_draw_apple(int x, int y, int w, int h)
{
int xx, yy;
for (xx = 0; xx < w; xx++)
{
for (yy = 0; yy < h; yy++)
{
if
(x + xx >= 0
&& x + xx < KOULESMAPWIDTH
&& y + yy >= 0
&& y + yy < KOULESMAPHEIGHT
&& koules_apple_bitmap[xx][yy] != 0
)
{
koulesdisplay[(y + yy)*KOULESWINWIDTH+x + xx] = koulespens[koules_apple_bitmap[xx][yy]];
}
}
}
}
void KoulesClearScreen(void)
{
int x, y;
if (koulesgamemode == KOULESMODEMENU)
{
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = 0; y < KOULESMAPHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x000066; // dark blue
}
}
}
else if (koulesgameplan == COOPERATIVE)
{
if (kouleslevel == 99)
{
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = 0; y < KOULESMAPHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x660066; // dark purple
}
}
}
else if (kouleslevel % 2)
{
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = 0; y < KOULESMAPHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x666600; // dark yellow
}
}
}
else
{
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = 0; y < KOULESMAPHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x006600; // dark green
}
}
}
}
else // assert(koulesgameplan == DEATHMATCH);
{
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = 0; y < KOULESMAPHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x660000; // dark red
}
}
}
for (x = 0; x < KOULESWINWIDTH; x++)
{
koulesdisplay[KOULESMAPHEIGHT *KOULESWINWIDTH+x] = 0x00FFFFFF;
koulesdisplay[(KOULESMAPHEIGHT + 1)*KOULESWINWIDTH+x] = 0x00000000;
}
for (x = 0; x < KOULESWINWIDTH; x++)
{
for (y = KOULESMAPHEIGHT + 2; y < KOULESWINHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+x] = 0x666666; // dark grey
}
}
for (y = KOULESMAPHEIGHT + 1; y < KOULESWINHEIGHT; y++)
{
koulesdisplay[y*KOULESWINWIDTH+KOULESMAPLINEPOS] = 0x00FFFFFF;
koulesdisplay[y*KOULESWINWIDTH+KOULESMAPLINEPOS+1] = 0x00000000;
}
for (y = 0; y < 16; y++)
{
for (x = 0; x < 16; x++)
{
koulesdisplay[(KOULESMAPHEIGHT + 6 + y)*KOULESWINWIDTH+KOULESMAPLINEPOS+6 + x] = koulesamigan[y][x];
}
}
}
int KoulesInit()
{
// int i;
// for (i = 0; i < 64; i++)
// { KeyMatrix[i] = 0;
// }
// for (i = 0; i < CHANNELS; i++)
// { WaveOpened[i] = WavePrepared[i] = FALSE;
// }
kouleskeys[0][0] = &koules_key_up;
kouleskeys[0][1] = &koules_key_down;
kouleskeys[0][2] = &koules_key_left;
kouleskeys[0][3] = &koules_key_right;
kouleskeys[1][0] = &koules_key_up;
kouleskeys[1][1] = &koules_key_down;
kouleskeys[1][2] = &koules_key_left;
kouleskeys[1][3] = &koules_key_right;
kouleskeys[2][0] = &koules_key_up;
kouleskeys[2][1] = &koules_key_down;
kouleskeys[2][2] = &koules_key_left;
kouleskeys[2][3] = &koules_key_right;
koules_key_pause = 0;
//titleheight=16;
Koules_load_rc();
Koules_load_sounds();
#ifdef __arm
FileFuncInit();
#endif
// srand((unsigned int) time(NULL));
// joy[0] = joy[1] = FALSE;
// if (joySetCapture(WindowPtr, JOYSTICKID1, 0, FALSE) == JOYERR_NOERROR)
// { joy[0] = TRUE;
// }
// if (joySetCapture(WindowPtr, JOYSTICKID2, 0, FALSE) == JOYERR_NOERROR)
// { joy[1] = TRUE;
// }
// captures are automatically released when window is destroyed.
// for (i = 0; i < sizeof(BITMAPINFOHEADER) + (4 * 4); i++)
// { bitmapbuffer[i] = 0;
// }
// BitmapHeaderPtr = (BITMAPINFO *)&bitmapbuffer;
// BitmapHeaderPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
// BitmapHeaderPtr->bmiHeader.biPlanes = 1;
// BitmapHeaderPtr->bmiHeader.biWidth = KOULESWINWIDTH;
// BitmapHeaderPtr->bmiHeader.biHeight = -KOULESWINHEIGHT; // note well
// BitmapHeaderPtr->bmiHeader.biBitCount = 32;
// BitmapHeaderPtr->bmiHeader.biCompression = BI_BITFIELDS;
// ((unsigned long *)BitmapHeaderPtr->bmiColors)[0] = 0x00FF0000;
// ((unsigned long *)BitmapHeaderPtr->bmiColors)[1] = 0x0000FF00;
// ((unsigned long *)BitmapHeaderPtr->bmiColors)[2] = 0x000000FF;
Koules_create_bitmap();
// drawbackground ();//darnshong del
Koules_init_objects();
// game();
// Koulescleanexit(EXIT_SUCCESS);
koulesdisplay = (int*)RKmalloc(KOULESWINHEIGHT * KOULESWINWIDTH * sizeof(int));
return(0); // never executed
}
void KoulesUpdateInput(void)
{
//Koules_updatescreen();
//TR("update!");
}
//LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
//{ PAINTSTRUCT ps;
//
// switch(msg)
// { case WM_PAINT:
// BeginPaint(hwnd, &ps);
// Koules_updatescreen(); // (not really needed unless paused)
// EndPaint(hwnd, &ps);
// acase WM_CLOSE:
// Koulescleanexit(EXIT_SUCCESS);
// acase WM_DESTROY:
// PostQuitMessage(0);
// adefault:
// return DefWindowProc(hwnd, msg, wParam, lParam);
// }
// return 0;
//}
void Koules_updatescreen(void)
{
// int i,j;
LCD_RGBDATA temp;
LCD_RGBDATA *pdest = gGuiDspLcdLogic;
int *psrc = koulesdisplay;
if (koulesdisplay == NULL) return;
LOGICUPDATE_DISABLE();
// for (j = 0; j < LCD_H; j++)
// for (i = 0; i < LCD_W; i++)
// pdest[j*LCD_W+i]=psrc[j*LCD_W+i];
memcpy(pdest, psrc, KOULESWINWIDTH*KOULESWINHEIGHT*sizeof(int));
LOGICUPDATE_ENABLE();
// gScreenUpdateX0=0;
// gScreenUpdateY0=0;
// gScreenUpdateX1=LCD_W;
// gScreenUpdateY1=LCD_H;
RKOSSendMsg(MBDISP, MS_ISRDI_FlushInd, NULL);
// DoLcdFlush(gGuiDspLcdLogic);
}
BOOL KoulesIsPressed(UBYTE *p)
{
if (*p)
{
return TRUE;
}
else
{
return FALSE;
}
}
//EXPORT int ReadJoystick(int joynum)
//{
//// JOYINFO JoyInfo;
//// int s = 0;
//// UINT id;
////
//// if (!joy[joynum])
//// { return 0;
//// }
////
//// // joynum will be '0' if they want the PRIMARY port
//// // joynum will be '1' if they want the SECONDARY port
//// if (joynum == 0)
//// { id = JOYSTICKID1;
//// } else
//// { // assert(joynum == 1);
//// id = JOYSTICKID2;
//// }
////
//// if (joy[joynum] && joyGetPos(id, &JoyInfo) == JOYERR_NOERROR)
//// { if ( JoyInfo.wXpos < 0 && JoyInfo.wYpos < 0)
//// { s = 1; // up-left
//// } elif (JoyInfo.wXpos > 0 && JoyInfo.wYpos < 0)
//// { s = 2; // up-right
//// } elif (JoyInfo.wXpos > 0 && JoyInfo.wYpos > 0)
//// { s = 3; // down-right
//// } elif (JoyInfo.wXpos < 0 && JoyInfo.wYpos > 0)
//// { s = 4; // down-left
//// } elif (JoyInfo.wXpos < 0)
//// { s = 5; // left
//// } elif (JoyInfo.wXpos > 0)
//// { s = 6; // right
//// } elif (JoyInfo.wYpos < 0)
//// { s = 7; // up
//// } elif (JoyInfo.wYpos > 0)
//// { s = 8; // down
//// } }
////
//// return s;
//}
void Koules_load_rc(void)
{ /* FILE* LocalHandle;
UBYTE ConfigBuffer[11];
int i;
if ((LocalHandle = fopen("KOULES.CFG", "rb")))
{ if (fread(ConfigBuffer, 10, 1, LocalHandle) == 1)
{ // byte 0: version (1 means 1.0, 2 means 1.01)
for (i = 0; i <= 4; i++)
{ koulescontroller[i] = (int) ConfigBuffer[i + 1];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -