Applied SURFACE_ID constants to everything

This commit is contained in:
Clownacy 2019-02-18 14:36:58 +00:00
parent f08c1c3aa6
commit 132d3c5110
22 changed files with 179 additions and 170 deletions

View file

@ -265,27 +265,27 @@ void PutCampObject()
//Draw box //Draw box
int y; int y;
PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, (WINDOW_HEIGHT - 224) / 2, &rcBoxTop, 26); PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, (WINDOW_HEIGHT - 224) / 2, &rcBoxTop, SURFACE_ID_TEXT_BOX);
for (y = 1; y < 18; y++) for (y = 1; y < 18; y++)
PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBody, 26); PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBody, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBottom, 26); PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBottom, SURFACE_ID_TEXT_BOX);
//Move titles //Move titles
if (gCampTitleY > (WINDOW_HEIGHT - 208) / 2) if (gCampTitleY > (WINDOW_HEIGHT - 208) / 2)
--gCampTitleY; --gCampTitleY;
//Draw titles //Draw titles
PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY, &rcTitle1, 26); PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY, &rcTitle1, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY + 52, &rcTitle2, 26); PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY + 52, &rcTitle2, SURFACE_ID_TEXT_BOX);
//Draw arms cursor //Draw arms cursor
static int flash; static int flash;
++flash; ++flash;
if (gCampActive) if (gCampActive)
PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[1], 26); PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[1], SURFACE_ID_TEXT_BOX);
else else
PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[(flash >> 1) & 1], 26); PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[(flash >> 1) & 1], SURFACE_ID_TEXT_BOX);
//Draw arms //Draw arms
for (int i = 0; i < ARMS_MAX && gArmsData[i].code; i++) for (int i = 0; i < ARMS_MAX && gArmsData[i].code; i++)
@ -296,9 +296,9 @@ void PutCampObject()
rcArms.top = 16 * (gArmsData[i].code / 16); rcArms.top = 16 * (gArmsData[i].code / 16);
rcArms.bottom = rcArms.top + 16; rcArms.bottom = rcArms.top + 16;
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, 12); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, SURFACE_ID_ARMS_IMAGE);
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, 26); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, 26); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, SURFACE_ID_TEXT_BOX);
PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, 0); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, 0);
//Draw ammo //Draw ammo
@ -309,16 +309,16 @@ void PutCampObject()
} }
else else
{ {
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 144) / 2, &rcNone, 26); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 144) / 2, &rcNone, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 128) / 2, &rcNone, 26); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 128) / 2, &rcNone, SURFACE_ID_TEXT_BOX);
} }
} }
//Draw items cursor //Draw items cursor
if (gCampActive) if (gCampActive)
PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[(flash >> 1) & 1], 26); PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[(flash >> 1) & 1], SURFACE_ID_TEXT_BOX);
else else
PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[1], 26); PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[1], SURFACE_ID_TEXT_BOX);
for (int i = 0; i < ITEM_MAX && gItemData[i].code; i++) for (int i = 0; i < ITEM_MAX && gItemData[i].code; i++)
{ {
@ -328,7 +328,7 @@ void PutCampObject()
rcItem.top = 16 * (gItemData[i].code / 8); rcItem.top = 16 * (gItemData[i].code / 8);
rcItem.bottom = rcItem.top + 16; rcItem.bottom = rcItem.top + 16;
PutBitmap3(&rcView, 32 * (i % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (i / 6) + (WINDOW_HEIGHT - 88) / 2, &rcItem, 8); PutBitmap3(&rcView, 32 * (i % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (i / 6) + (WINDOW_HEIGHT - 88) / 2, &rcItem, SURFACE_ID_ITEM_IMAGE);
} }
} }
@ -383,7 +383,7 @@ int CampLoop()
return 2; return 2;
} }
PutBitmap4(&rcView, 0, 0, &rcView, 10); PutBitmap4(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB);
PutCampObject(); PutCampObject();
PutTextScript(); PutTextScript();
PutFramePerSecound(); PutFramePerSecound();

View file

@ -66,7 +66,7 @@ void PutBossChar(int fx, int fy)
(gBoss[b].x - side) / 0x200 - fx / 0x200 + a, (gBoss[b].x - side) / 0x200 - fx / 0x200 + a,
(gBoss[b].y - gBoss[b].view.top) / 0x200 - fy / 0x200, (gBoss[b].y - gBoss[b].view.top) / 0x200 - fy / 0x200,
&gBoss[b].rect, &gBoss[b].rect,
22); SURFACE_ID_LEVEL_SPRITESET_2);
} }
} }
} }

View file

@ -135,7 +135,7 @@ void PutBullet(int fx, int fy)
break; break;
} }
PutBitmap3(&grcGame, x / 0x200 - fx / 0x200, y / 0x200 - fy / 0x200, &gBul[i].rect, 17); PutBitmap3(&grcGame, x / 0x200 - fx / 0x200, y / 0x200 - fy / 0x200, &gBul[i].rect, SURFACE_ID_BULLET);
} }
} }
} }

View file

@ -539,7 +539,7 @@ void PutCaret(int fx, int fy)
(gCrt[i].x - gCrt[i].view_left) / 0x200 - fx / 0x200, (gCrt[i].x - gCrt[i].view_left) / 0x200 - fx / 0x200,
(gCrt[i].y - gCrt[i].view_top) / 0x200 - fy / 0x200, (gCrt[i].y - gCrt[i].view_top) / 0x200 - fy / 0x200,
&gCrt[i].rect, &gCrt[i].rect,
19); SURFACE_ID_CARET);
} }
} }
} }

View file

@ -133,7 +133,7 @@ void ReleaseSurface(int s)
} }
} }
bool MakeSurface_Generic(int bxsize, int bysize, int surf_no) bool MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no)
{ {
bool success = false; bool success = false;
@ -182,7 +182,7 @@ bool MakeSurface_Generic(int bxsize, int bysize, int surf_no)
return success; return success;
} }
static void FlushSurface(int surf_no) static void FlushSurface(Surface_Ids surf_no)
{ {
unsigned char *raw_pixels; unsigned char *raw_pixels;
int pitch; int pitch;
@ -209,7 +209,7 @@ static void FlushSurface(int surf_no)
SDL_UnlockTexture(surf[surf_no].texture); SDL_UnlockTexture(surf[surf_no].texture);
} }
static bool LoadBitmap(SDL_RWops *fp, int surf_no, bool create_surface) static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface)
{ {
bool success = false; bool success = false;
@ -292,7 +292,7 @@ static bool LoadBitmap(SDL_RWops *fp, int surf_no, bool create_surface)
return success; return success;
} }
static bool LoadBitmap_File(const char *name, int surf_no, bool create_surface) static bool LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_surface)
{ {
char path[PATH_LENGTH]; char path[PATH_LENGTH];
SDL_RWops *fp; SDL_RWops *fp;
@ -329,7 +329,7 @@ static bool LoadBitmap_File(const char *name, int surf_no, bool create_surface)
return false; return false;
} }
static bool LoadBitmap_Resource(const char *res, int surf_no, bool create_surface) static bool LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool create_surface)
{ {
SDL_RWops *fp = FindResource(res); SDL_RWops *fp = FindResource(res);
@ -344,22 +344,22 @@ static bool LoadBitmap_Resource(const char *res, int surf_no, bool create_surfac
return false; return false;
} }
bool MakeSurface_File(const char *name, int surf_no) bool MakeSurface_File(const char *name, Surface_Ids surf_no)
{ {
return LoadBitmap_File(name, surf_no, true); return LoadBitmap_File(name, surf_no, true);
} }
bool MakeSurface_Resource(const char *res, int surf_no) bool MakeSurface_Resource(const char *res, Surface_Ids surf_no)
{ {
return LoadBitmap_Resource(res, surf_no, true); return LoadBitmap_Resource(res, surf_no, true);
} }
bool ReloadBitmap_File(const char *name, int surf_no) bool ReloadBitmap_File(const char *name, Surface_Ids surf_no)
{ {
return LoadBitmap_File(name, surf_no, false); return LoadBitmap_File(name, surf_no, false);
} }
bool ReloadBitmap_Resource(const char *res, int surf_no) bool ReloadBitmap_Resource(const char *res, Surface_Ids surf_no)
{ {
return LoadBitmap_Resource(res, surf_no, false); return LoadBitmap_Resource(res, surf_no, false);
} }
@ -374,7 +374,7 @@ SDL_Rect RectToSDLRect(RECT *rect)
return SDLRect; return SDLRect;
} }
void BackupSurface(int surf_no, RECT *rect) void BackupSurface(Surface_Ids surf_no, RECT *rect)
{ {
//Get renderer size //Get renderer size
int w, h; int w, h;
@ -396,7 +396,7 @@ void BackupSurface(int surf_no, RECT *rect)
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
} }
static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, int surf_no, bool transparent) static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, bool transparent)
{ {
if (surf[surf_no].needs_updating) if (surf[surf_no].needs_updating)
{ {
@ -427,12 +427,12 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, int surf_no, bool
SDL_RenderSetClipRect(gRenderer, NULL); SDL_RenderSetClipRect(gRenderer, NULL);
} }
void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, int surf_no) //Transparency void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //Transparency
{ {
DrawBitmap(rcView, x, y, rect, surf_no, true); DrawBitmap(rcView, x, y, rect, surf_no, true);
} }
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, int surf_no) //No Transparency void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //No Transparency
{ {
DrawBitmap(rcView, x, y, rect, surf_no, false); DrawBitmap(rcView, x, y, rect, surf_no, false);
} }
@ -459,7 +459,7 @@ void CortBox(RECT *rect, uint32_t col)
SDL_RenderFillRect(gRenderer, &destRect); SDL_RenderFillRect(gRenderer, &destRect);
} }
void CortBox2(RECT *rect, uint32_t col, int surf_no) void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no)
{ {
//Get rect //Get rect
SDL_Rect destRect = RectToSDLRect(rect); SDL_Rect destRect = RectToSDLRect(rect);
@ -581,7 +581,7 @@ void PutText(int x, int y, const char *text, uint32_t color)
SDL_DestroyTexture(screen_texture); SDL_DestroyTexture(screen_texture);
} }
void PutText2(int x, int y, const char *text, uint32_t color, int surf_no) void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no)
{ {
DrawText(gFont, surf[surf_no].surface, x * magnification, y * magnification, color, text, strlen(text)); DrawText(gFont, surf[surf_no].surface, x * magnification, y * magnification, color, text, strlen(text));
surf[surf_no].needs_updating = true; surf[surf_no].needs_updating = true;

View file

@ -12,35 +12,41 @@ extern RECT grcFull;
extern int magnification; extern int magnification;
extern bool fullscreen; extern bool fullscreen;
enum Surface_Ids typedef enum Surface_Ids
{ {
SURFACE_ID_TITLE = 0x0, SURFACE_ID_TITLE = 0,
SURFACE_ID_PIXEL = 0x1, SURFACE_ID_PIXEL = 1,
SURFACE_ID_LEVEL_TILESET = 0x2, SURFACE_ID_LEVEL_TILESET = 2,
SURFACE_ID_FADE = 0x6, SURFACE_ID_FADE = 6,
SURFACE_ID_ITEM_IMAGE = 0x8, SURFACE_ID_ITEM_IMAGE = 8,
SURFACE_ID_MAP = 0x9, SURFACE_ID_MAP = 9,
SURFACE_ID_SCREEN_GRAB = 0xA, SURFACE_ID_SCREEN_GRAB = 10,
SURFACE_ID_ARMS = 0xB, SURFACE_ID_ARMS = 11,
SURFACE_ID_ARMS_IMAGE = 0xC, SURFACE_ID_ARMS_IMAGE = 12,
SURFACE_ID_ROOM_NAME = 0xD, SURFACE_ID_ROOM_NAME = 13,
SURFACE_ID_STAGE_ITEM = 0xE, SURFACE_ID_STAGE_ITEM = 14,
SURFACE_ID_LOADING = 0xF, SURFACE_ID_LOADING = 15,
SURFACE_ID_MY_CHAR = 0x10, SURFACE_ID_MY_CHAR = 16,
SURFACE_ID_BULLET = 0x11, SURFACE_ID_BULLET = 17,
SURFACE_ID_CARET = 0x13, SURFACE_ID_CARET = 19,
SURFACE_ID_NPC_SYM = 0x14, SURFACE_ID_NPC_SYM = 20,
SURFACE_ID_LEVEL_SPRITESET_1 = 0x15, SURFACE_ID_LEVEL_SPRITESET_1 = 21,
SURFACE_ID_LEVEL_SPRITESET_2 = 0x16, SURFACE_ID_LEVEL_SPRITESET_2 = 22,
SURFACE_ID_NPC_REGU = 0x17, SURFACE_ID_NPC_REGU = 23,
SURFACE_ID_TEXT_BOX = 0x1A, SURFACE_ID_TEXT_BOX = 26,
SURFACE_ID_FACE = 0x1B, SURFACE_ID_FACE = 27,
SURFACE_ID_LEVEL_BACKGROUND = 0x1C, SURFACE_ID_LEVEL_BACKGROUND = 28,
SURFACE_ID_CREDIT_CAST = 0x23, SURFACE_ID_VALUE_VIEW = 29,
SURFACE_ID_CREDITS_IMAGE = 0x24, SURFACE_ID_TEXT_LINE1 = 30,
SURFACE_ID_CASTS = 0x25, SURFACE_ID_TEXT_LINE2 = 31,
SURFACE_ID_MAX = 0x28, SURFACE_ID_TEXT_LINE3 = 32,
}; SURFACE_ID_TEXT_LINE4 = 33,
SURFACE_ID_TEXT_LINE5 = 34,
SURFACE_ID_CREDIT_CAST = 35,
SURFACE_ID_CREDITS_IMAGE = 36,
SURFACE_ID_CASTS = 37,
SURFACE_ID_MAX = 40,
} Surface_Ids;
struct SURFACE struct SURFACE
{ {
@ -56,18 +62,18 @@ bool Flip_SystemTask();
bool StartDirectDraw(int lMagnification, int lColourDepth); bool StartDirectDraw(int lMagnification, int lColourDepth);
void EndDirectDraw(); void EndDirectDraw();
void ReleaseSurface(int s); void ReleaseSurface(int s);
bool MakeSurface_File(const char *name, int surf_no); bool MakeSurface_File(const char *name, Surface_Ids surf_no);
bool MakeSurface_Resource(const char *res, int surf_no); bool MakeSurface_Resource(const char *res, Surface_Ids surf_no);
bool ReloadBitmap_File(const char *name, int surf_no); bool ReloadBitmap_File(const char *name, Surface_Ids surf_no);
bool ReloadBitmap_Resource(const char *res, int surf_no); bool ReloadBitmap_Resource(const char *res, Surface_Ids surf_no);
bool MakeSurface_Generic(int bxsize, int bysize, int surf_no); bool MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no);
void BackupSurface(int surf_no, RECT *rect); void BackupSurface(Surface_Ids surf_no, RECT *rect);
void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, int surf_no); void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no);
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, int surf_no); void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no);
void Surface2Surface(int x, int y, RECT *rect, int to, int from); void Surface2Surface(int x, int y, RECT *rect, int to, int from);
void CortBox(RECT *rect, uint32_t col); void CortBox(RECT *rect, uint32_t col);
void CortBox2(RECT *rect, uint32_t col, int surf_no); void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no);
void InitTextObject(const char *font_name); void InitTextObject(const char *font_name);
void PutText(int x, int y, const char *text, uint32_t color); void PutText(int x, int y, const char *text, uint32_t color);
void PutText2(int x, int y, const char *text, uint32_t color, int surf_no); void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no);
void EndTextObject(); void EndTextObject();

View file

@ -455,9 +455,9 @@ int Scene_DownIsland(int mode)
//Draw scene //Draw scene
CortBox(&grcFull, 0); CortBox(&grcFull, 0);
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, 21); PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, 21); PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, 21); PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
PutTimeCounter(16, 8); PutTimeCounter(16, 8);
//Draw window //Draw window

View file

@ -33,7 +33,7 @@ int Call_Escape()
//Draw screen //Draw screen
CortBox(&grcFull, 0x000000); CortBox(&grcFull, 0x000000);
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask()) if (!Flip_SystemTask())

View file

@ -283,7 +283,7 @@ void PutFade()
{ {
rect.left = 16 * gFade.ani_no[y][x]; rect.left = 16 * gFade.ani_no[y][x];
rect.right = rect.left + 16; rect.right = rect.left + 16;
PutBitmap3(&grcGame, 16 * x, 16 * y, &rect, 6); PutBitmap3(&grcGame, 16 * x, 16 * y, &rect, SURFACE_ID_FADE);
} }
} }
} }

View file

@ -352,14 +352,14 @@ int ModeTitle()
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0); PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
//Draw main title //Draw main title
PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, 0); PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, 0); PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, 0); PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, 1); PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL);
//Draw character cursor //Draw character cursor
RECT char_rc; RECT char_rc;
int char_surf; Surface_Ids char_surf;
switch ( char_type ) switch ( char_type )
{ {
@ -530,7 +530,7 @@ int ModeAction()
//Open inventory //Open inventory
if (gKeyTrg & gKeyItem) if (gKeyTrg & gKeyItem)
{ {
BackupSurface(10, &grcGame); BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
switch (CampLoop()) switch (CampLoop())
{ {
@ -544,7 +544,7 @@ int ModeAction()
} }
else if (gMC.equip & 2 && gKeyTrg & gKeyMap) else if (gMC.equip & 2 && gKeyTrg & gKeyMap)
{ {
BackupSurface(10, &grcGame); BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
switch (MiniMapLoop()) switch (MiniMapLoop())
{ {

View file

@ -149,37 +149,37 @@ static const PIXTONEPARAMETER gPtpTable[139] =
bool LoadGenericData() bool LoadGenericData()
{ {
MakeSurface_Resource("PIXEL", 1); MakeSurface_Resource("PIXEL", SURFACE_ID_PIXEL);
bool bError = false; bool bError = false;
if (!MakeSurface_File("MyChar", 16)) if (!MakeSurface_File("MyChar", SURFACE_ID_MY_CHAR))
bError = true; bError = true;
if (!MakeSurface_File("Title", 0)) if (!MakeSurface_File("Title", SURFACE_ID_TITLE))
bError = true; bError = true;
if (!MakeSurface_File("ArmsImage", 12)) if (!MakeSurface_File("ArmsImage", SURFACE_ID_ARMS_IMAGE))
bError = true; bError = true;
if (!MakeSurface_File("Arms", 11)) if (!MakeSurface_File("Arms", SURFACE_ID_ARMS))
bError = true; bError = true;
if (!MakeSurface_File("ItemImage", 8)) if (!MakeSurface_File("ItemImage", SURFACE_ID_ITEM_IMAGE))
bError = true; bError = true;
if (!MakeSurface_File("StageImage", 14)) if (!MakeSurface_File("StageImage", SURFACE_ID_STAGE_ITEM))
bError = true; bError = true;
if (!MakeSurface_File("Npc/NpcSym", 20)) if (!MakeSurface_File("Npc/NpcSym", SURFACE_ID_NPC_SYM))
bError = true; bError = true;
if (!MakeSurface_File("Npc/NpcRegu", 23)) if (!MakeSurface_File("Npc/NpcRegu", SURFACE_ID_NPC_REGU))
bError = true; bError = true;
if (!MakeSurface_File("TextBox", 26)) if (!MakeSurface_File("TextBox", SURFACE_ID_TEXT_BOX))
bError = true; bError = true;
if (!MakeSurface_File("Caret", 19)) if (!MakeSurface_File("Caret", SURFACE_ID_CARET))
bError = true; bError = true;
if (!MakeSurface_File("Bullet", 17)) if (!MakeSurface_File("Bullet", SURFACE_ID_BULLET))
bError = true; bError = true;
if (!MakeSurface_File("Face", 27)) if (!MakeSurface_File("Face", SURFACE_ID_FACE))
bError = true; bError = true;
if (!MakeSurface_File("Fade", 6)) if (!MakeSurface_File("Fade", SURFACE_ID_FADE))
bError = true; bError = true;
MakeSurface_Resource("CREDIT01", 36); MakeSurface_Resource("CREDIT01", SURFACE_ID_CREDITS_IMAGE);
if (bError) if (bError)
{ {
@ -190,10 +190,10 @@ bool LoadGenericData()
MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_SCREEN_GRAB); MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_SCREEN_GRAB);
MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_LEVEL_BACKGROUND); MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_LEVEL_BACKGROUND);
MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_MAP); MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_MAP);
MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, 37); //Unknown? MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_CASTS);
MakeSurface_Generic(256, 256, SURFACE_ID_LEVEL_TILESET); MakeSurface_Generic(256, 256, SURFACE_ID_LEVEL_TILESET);
MakeSurface_Generic(160, 16, SURFACE_ID_ROOM_NAME); MakeSurface_Generic(160, 16, SURFACE_ID_ROOM_NAME);
MakeSurface_Generic(40, 240, 29); //Unknown? MakeSurface_Generic(40, 240, SURFACE_ID_VALUE_VIEW);
MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_1); MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_1);
MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_2); MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_2);
MakeSurface_Generic(WINDOW_WIDTH, 16 * MAX_STRIP, SURFACE_ID_CREDIT_CAST); MakeSurface_Generic(WINDOW_WIDTH, 16 * MAX_STRIP, SURFACE_ID_CREDIT_CAST);

View file

@ -100,7 +100,7 @@ int MiniMapLoop()
} }
} }
PutBitmap4(&grcGame, 0, 0, &grcGame, 10); PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16}; rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16};
PutMapName(true); PutMapName(true);
@ -114,7 +114,7 @@ int MiniMapLoop()
RECT rcMiniMap = {0, 0, gMap.width, gMap.length}; RECT rcMiniMap = {0, 0, gMap.width, gMap.length};
rcView.right = --rcView.left + gMap.width + 2; rcView.right = --rcView.left + gMap.width + 2;
rcView.bottom = --rcView.top + gMap.length + 2; rcView.bottom = --rcView.top + gMap.length + 2;
CortBox2(&rcMiniMap, 0, 9); CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
int line = 0; int line = 0;
uint8_t my_wait = 0; uint8_t my_wait = 0;
@ -136,19 +136,19 @@ int MiniMapLoop()
} }
} }
PutBitmap4(&grcGame, 0, 0, &grcGame, 10); PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
CortBox(&rcView, 0); CortBox(&rcView, 0);
if (gMap.length > line) if (gMap.length > line)
WriteMiniMapLine(line++); WriteMiniMapLine(line++);
if (gMap.length > line) if (gMap.length > line)
WriteMiniMapLine(line++); WriteMiniMapLine(line++);
PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, 9); PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, SURFACE_ID_MAP);
PutMapName(true); PutMapName(true);
if ((++my_wait >> 3) & 1) if ((++my_wait >> 3) & 1)
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, 26); PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask()) if (!Flip_SystemTask())
@ -170,7 +170,7 @@ int MiniMapLoop()
} }
} }
PutBitmap4(&grcGame, 0, 0, &grcGame, 10); PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16}; rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16};
PutMapName(true); PutMapName(true);
CortBox(&rcView, 0); CortBox(&rcView, 0);

View file

@ -193,14 +193,14 @@ void PutMyChar(int fx, int fy)
(gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200,
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
&gMC.rect_arms, &gMC.rect_arms,
11); SURFACE_ID_ARMS);
else else
PutBitmap3( PutBitmap3(
&grcGame, &grcGame,
(gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8,
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
&gMC.rect_arms, &gMC.rect_arms,
11); SURFACE_ID_ARMS);
if (!((gMC.shock >> 1) & 1)) if (!((gMC.shock >> 1) & 1))
{ {
@ -212,7 +212,7 @@ void PutMyChar(int fx, int fy)
rect.bottom += 32; rect.bottom += 32;
} }
PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, 16); PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
//Draw airtank //Draw airtank
RECT rcBubble[2]; RECT rcBubble[2];
@ -221,9 +221,9 @@ void PutMyChar(int fx, int fy)
++gMC.bubble; ++gMC.bubble;
if (gMC.equip & 0x10 && gMC.flag & 0x100) if (gMC.equip & 0x10 && gMC.flag & 0x100)
PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], 19); PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET);
else if (gMC.unit == 1) else if (gMC.unit == 1)
PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], 19); PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET);
} }
} }
} }

View file

@ -218,15 +218,15 @@ void PutArmsEnergy(bool flash)
} }
else else
{ {
PutBitmap3(&rcView, gArmsEnergyX + 48, 16, &rcNone, 26); PutBitmap3(&rcView, gArmsEnergyX + 48, 16, &rcNone, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, gArmsEnergyX + 48, 24, &rcNone, 26); PutBitmap3(&rcView, gArmsEnergyX + 48, 24, &rcNone, SURFACE_ID_TEXT_BOX);
} }
//Draw experience and ammo //Draw experience and ammo
if (!flash || !((gMC.shock >> 1) & 1)) if (!flash || !((gMC.shock >> 1) & 1))
{ {
PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, 26); PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, 26); PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX);
PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, 0); PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, 0);
RECT rcExpBox = {0, 72, 40, 80}; RECT rcExpBox = {0, 72, 40, 80};
@ -239,7 +239,7 @@ void PutArmsEnergy(bool flash)
int exp_now = gArmsData[gSelectedArms].exp; int exp_now = gArmsData[gSelectedArms].exp;
int exp_next = gArmsLevelTable[0].exp[lv + 3 * arms_code]; int exp_next = gArmsLevelTable[0].exp[lv + 3 * arms_code];
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, 26); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, SURFACE_ID_TEXT_BOX);
if (lv != 2 || gArmsData[gSelectedArms].exp != gArmsLevelTable[0].exp[3 * arms_code + 2]) if (lv != 2 || gArmsData[gSelectedArms].exp != gArmsLevelTable[0].exp[3 * arms_code + 2])
{ {
@ -248,16 +248,16 @@ void PutArmsEnergy(bool flash)
else else
rcExpVal.right = 0; rcExpVal.right = 0;
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, 26); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX);
} }
else else
{ {
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpMax, 26); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpMax, SURFACE_ID_TEXT_BOX);
} }
static int add_flash = true; static int add_flash = true;
if (gMC.exp_wait && ((add_flash++ >> 1) & 1)) if (gMC.exp_wait && ((add_flash++ >> 1) & 1))
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, 26); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, SURFACE_ID_TEXT_BOX);
} }
} }
@ -293,7 +293,7 @@ void PutActiveArmsList()
//Draw icon //Draw icon
rect.left = 16 * gArmsData[a].code; rect.left = 16 * gArmsData[a].code;
rect.right = rect.left + 16; rect.right = rect.left + 16;
PutBitmap3(&grcGame, x, 16, &rect, 12); PutBitmap3(&grcGame, x, 16, &rect, SURFACE_ID_ARMS_IMAGE);
} }
} }
} }
@ -319,9 +319,9 @@ void PutMyLife(bool flash)
rcLife.right = 40 * gMC.life / gMC.max_life - 1; rcLife.right = 40 * gMC.life / gMC.max_life - 1;
rcBr.right = 40 * gMC.lifeBr / gMC.max_life - 1; rcBr.right = 40 * gMC.lifeBr / gMC.max_life - 1;
PutBitmap3(&grcGame, 16, 40, &rcCase, 26); PutBitmap3(&grcGame, 16, 40, &rcCase, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, 40, 40, &rcBr, 26); PutBitmap3(&grcGame, 40, 40, &rcBr, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, 40, 40, &rcLife, 26); PutBitmap3(&grcGame, 40, 40, &rcLife, SURFACE_ID_TEXT_BOX);
PutNumber4(8, 40, gMC.lifeBr, 0); PutNumber4(8, 40, gMC.lifeBr, 0);
} }
} }
@ -340,9 +340,9 @@ void PutMyAir(int x, int y)
//Draw "AIR" text //Draw "AIR" text
if (gMC.air % 30 <= 10) if (gMC.air % 30 <= 10)
PutBitmap3(&grcGame, x, y, &rcAir[1], 26); PutBitmap3(&grcGame, x, y, &rcAir[1], SURFACE_ID_TEXT_BOX);
else else
PutBitmap3(&grcGame, x, y, &rcAir[0], 26); PutBitmap3(&grcGame, x, y, &rcAir[0], SURFACE_ID_TEXT_BOX);
} }
} }
@ -362,20 +362,20 @@ void PutTimeCounter(int x, int y)
++time_count; ++time_count;
if (time_count % 30 <= 10) if (time_count % 30 <= 10)
PutBitmap3(&grcGame, x, y, &rcTime[1], 26); PutBitmap3(&grcGame, x, y, &rcTime[1], SURFACE_ID_TEXT_BOX);
else else
PutBitmap3(&grcGame, x, y, &rcTime[0], 26); PutBitmap3(&grcGame, x, y, &rcTime[0], SURFACE_ID_TEXT_BOX);
} }
else else
{ {
PutBitmap3(&grcGame, x, y, &rcTime[0], 26); PutBitmap3(&grcGame, x, y, &rcTime[0], SURFACE_ID_TEXT_BOX);
} }
//Draw time //Draw time
PutNumber4(x, y, time_count / 3000, false); PutNumber4(x, y, time_count / 3000, false);
PutNumber4(x + 20, y, time_count / 50 % 60, true); PutNumber4(x + 20, y, time_count / 50 % 60, true);
PutNumber4(x + 32, y, time_count / 5 % 10, false); PutNumber4(x + 32, y, time_count / 5 % 10, false);
PutBitmap3(&grcGame, x + 30, y, &rcTime[2], 26); PutBitmap3(&grcGame, x + 30, y, &rcTime[2], SURFACE_ID_TEXT_BOX);
} }
else else
{ {

View file

@ -2,6 +2,8 @@
#include <stdint.h> #include <stdint.h>
#include "WindowsWrapper.h" #include "WindowsWrapper.h"
#include "Draw.h"
#define NPC_MAX 0x200 #define NPC_MAX 0x200
enum NPC_flags enum NPC_flags
@ -38,7 +40,7 @@ struct NPCHAR
int code_char; int code_char;
int code_flag; int code_flag;
int code_event; int code_event;
int surf; Surface_Ids surf;
int hit_voice; int hit_voice;
int destroy_voice; int destroy_voice;
int life; int life;

View file

@ -367,7 +367,7 @@ void ActNpc061(NPCHAR *npc)
SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
npc->act_no = 50; npc->act_no = 50;
npc->surf = 20; npc->surf = SURFACE_ID_NPC_SYM;
npc->ani_no = 10; npc->ani_no = 10;
} }

View file

@ -1479,7 +1479,7 @@ void ActNpc352(NPCHAR *npc)
case 9: case 9:
case 12: case 12:
case 13: case 13:
npc->surf = 21; npc->surf = SURFACE_ID_LEVEL_SPRITESET_1;
break; break;
default: default:
break; break;
@ -1747,28 +1747,28 @@ void ActNpc355(NPCHAR *npc)
switch (npc->direct) switch (npc->direct)
{ {
case 0: case 0:
npc->surf = 16; npc->surf = SURFACE_ID_MY_CHAR;
npc->ani_no = 0; npc->ani_no = 0;
npc->x = npc->pNpc->x - 0x1C00; npc->x = npc->pNpc->x - 0x1C00;
npc->y = npc->pNpc->y + 0x1400; npc->y = npc->pNpc->y + 0x1400;
break; break;
case 1: case 1:
npc->surf = 23; npc->surf = SURFACE_ID_NPC_REGU;
npc->ani_no = 1; npc->ani_no = 1;
npc->x = npc->pNpc->x + 0x1C00; npc->x = npc->pNpc->x + 0x1C00;
npc->y = npc->pNpc->y + 0x1400; npc->y = npc->pNpc->y + 0x1400;
break; break;
case 2: case 2:
npc->surf = 16; npc->surf = SURFACE_ID_MY_CHAR;
npc->ani_no = 2; npc->ani_no = 2;
npc->x = npc->pNpc->x - 0xE00; npc->x = npc->pNpc->x - 0xE00;
npc->y = npc->pNpc->y - 0x2600; npc->y = npc->pNpc->y - 0x2600;
break; break;
case 3: case 3:
npc->surf = 23; npc->surf = SURFACE_ID_NPC_REGU;
npc->ani_no = 3; npc->ani_no = 3;
npc->x = npc->pNpc->x + 0x800; npc->x = npc->pNpc->x + 0x800;
npc->y = npc->pNpc->y - 0x2600; npc->y = npc->pNpc->y - 0x2600;

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include "NpChar.h" #include "NpChar.h"
#include "Draw.h"
struct NPC_TBL_RECT struct NPC_TBL_RECT
{ {
@ -14,7 +15,7 @@ struct NPC_TABLE
{ {
uint16_t bits; uint16_t bits;
uint16_t life; uint16_t life;
uint8_t surf; Surface_Ids surf;
uint8_t hit_voice; uint8_t hit_voice;
uint8_t destroy_voice; uint8_t destroy_voice;
uint8_t size; uint8_t size;

View file

@ -138,7 +138,7 @@ int StageSelectLoop(int *p_event)
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
gSelectedStage = 0; gSelectedStage = 0;
BackupSurface(10, &grcFull); BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcFull);
GetTextScriptPath(old_script_path); GetTextScriptPath(old_script_path);
LoadTextScript2("StageSelect.tsc"); LoadTextScript2("StageSelect.tsc");
gStageSelectTitleY = (WINDOW_HEIGHT / 2) - 66; gStageSelectTitleY = (WINDOW_HEIGHT / 2) - 66;
@ -166,10 +166,10 @@ int StageSelectLoop(int *p_event)
return 2; return 2;
#ifdef FIX_BUGS #ifdef FIX_BUGS
PutBitmap4(&rcView, 0, 0, &rcView, 10); PutBitmap4(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB);
#else #else
// The original accidentally drew the screencap with transparency enabled // The original accidentally drew the screencap with transparency enabled
PutBitmap3(&rcView, 0, 0, &rcView, 10); PutBitmap3(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB);
#endif #endif
PutStageSelectObject(); PutStageSelectObject();
PutTextScript(); PutTextScript();

View file

@ -120,7 +120,7 @@ void PutStar(int fx, int fy)
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (gMC.star > i) if (gMC.star > i)
PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], 16); PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR);
} }
} }
} }

View file

@ -53,7 +53,7 @@ BOOL InitTextScript2()
//Create line surfaces //Create line surfaces
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
MakeSurface_Generic(gRect_line.right, gRect_line.bottom, i + 30); MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
//Clear text //Clear text
memset(text, 0, sizeof(text)); memset(text, 0, sizeof(text));
@ -216,7 +216,7 @@ BOOL StartTextScript(int no)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
gTS.ypos_line[i] = 16 * i; gTS.ypos_line[i] = 16 * i;
CortBox2(&gRect_line, 0x000000, i + 30); CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40); memset(&text[i * 0x40], 0, 0x40);
}*/ }*/
@ -265,7 +265,7 @@ BOOL JumpTextScript(int no)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
gTS.ypos_line[i] = 16 * i; gTS.ypos_line[i] = 16 * i;
CortBox2(&gRect_line, 0x000000, i + 30); CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40); memset(&text[i * 0x40], 0, 0x40);
} }
@ -317,7 +317,7 @@ void CheckNewLine()
{ {
gTS.mode = 3; gTS.mode = 3;
g_GameFlags |= 4; g_GameFlags |= 4;
CortBox2(&gRect_line, 0, gTS.line % 4 + 30); CortBox2(&gRect_line, 0, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
memset(&text[gTS.line % 4 * 0x40], 0, 0x40); memset(&text[gTS.line % 4 * 0x40], 0, 0x40);
} }
} }
@ -357,7 +357,7 @@ void SetNumberTextScript(int index)
str[offset + 1] = 0; str[offset + 1] = 0;
//Append number to line //Append number to line
PutText2(6 * gTS.p_write, 0, str, 0xFFFFFE, gTS.line % 4 + 30); PutText2(6 * gTS.p_write, 0, str, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
strcat(&text[gTS.line % 4 * 0x40], str); strcat(&text[gTS.line % 4 * 0x40], str);
//Play sound and reset blinking cursor //Play sound and reset blinking cursor
@ -385,7 +385,7 @@ void ClearTextLine()
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
gTS.ypos_line[i] = 16 * i; gTS.ypos_line[i] = 16 * i;
CortBox2(&gRect_line, 0x000000, i + 30); CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40); memset(&text[i * 0x40], 0, 0x40);
} }
} }
@ -418,11 +418,11 @@ void PutTextScript()
RECT rcFrame2 = {0, 8, 244, 16}; RECT rcFrame2 = {0, 8, 244, 16};
RECT rcFrame3 = {0, 16, 244, 24}; RECT rcFrame3 = {0, 16, 244, 24};
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, gTS.rcText.top - 10, &rcFrame1, 26); PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, gTS.rcText.top - 10, &rcFrame1, SURFACE_ID_TEXT_BOX);
int i; int i;
for (i = 1; i < 7; i++) for (i = 1; i < 7; i++)
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame2, 26); PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame2, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame3, 26); PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame3, SURFACE_ID_TEXT_BOX);
} }
//Draw face picture //Draw face picture
@ -434,7 +434,7 @@ void PutTextScript()
if (gTS.face_x < (TEXT_LEFT * 0x200)) if (gTS.face_x < (TEXT_LEFT * 0x200))
gTS.face_x += 0x1000; gTS.face_x += 0x1000;
PutBitmap3(&gTS.rcText, gTS.face_x / 0x200, gTS.rcText.top - 3, &rcFace, 27); PutBitmap3(&gTS.rcText, gTS.face_x / 0x200, gTS.rcText.top - 3, &rcFace, SURFACE_ID_FACE);
//Draw text //Draw text
int text_offset; int text_offset;
@ -444,7 +444,7 @@ void PutTextScript()
text_offset = 0; text_offset = 0;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, i + 30); PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
//Draw NOD cursor //Draw NOD cursor
if ((gTS.wait_beam++ % 20 > 12) && gTS.mode == 2) if ((gTS.wait_beam++ % 20 > 12) && gTS.mode == 2)
@ -466,12 +466,12 @@ void PutTextScript()
if (gTS.item) if (gTS.item)
{ {
PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 112, &rcItemBox1, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 112, &rcItemBox1, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 96, &rcItemBox2, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 96, &rcItemBox2, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 112, &rcItemBox3, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 112, &rcItemBox3, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 104, &rcItemBox4, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 104, &rcItemBox4, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 96, &rcItemBox4, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 96, &rcItemBox4, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 88, &rcItemBox5, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 88, &rcItemBox5, SURFACE_ID_TEXT_BOX);
if (gTS.item_y < WINDOW_HEIGHT - 104) if (gTS.item_y < WINDOW_HEIGHT - 104)
++gTS.item_y; ++gTS.item_y;
@ -483,7 +483,7 @@ void PutTextScript()
rect.right = rect.left + 16; rect.right = rect.left + 16;
rect.top = 16 * (gTS.item / 16); rect.top = 16 * (gTS.item / 16);
rect.bottom = rect.top + 16; rect.bottom = rect.top + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, 12); PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, SURFACE_ID_ARMS_IMAGE);
} }
else else
{ {
@ -491,7 +491,7 @@ void PutTextScript()
rect.right = rect.left + 32; rect.right = rect.left + 32;
rect.top = 16 * ((gTS.item - 1000) / 8); rect.top = 16 * ((gTS.item - 1000) / 8);
rect.bottom = rect.top + 16; rect.bottom = rect.top + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, 8); PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, SURFACE_ID_ITEM_IMAGE);
} }
} }
@ -507,9 +507,9 @@ void PutTextScript()
else else
i = WINDOW_HEIGHT - 96; i = WINDOW_HEIGHT - 96;
PutBitmap3(&grcFull, (WINDOW_WIDTH + 112) / 2, i, &rect_yesno, 26); PutBitmap3(&grcFull, (WINDOW_WIDTH + 112) / 2, i, &rect_yesno, SURFACE_ID_TEXT_BOX);
if (gTS.wait == 16) if (gTS.wait == 16)
PutBitmap3(&grcFull, 41 * gTS.select + (WINDOW_WIDTH + 102) / 2, WINDOW_HEIGHT - 86, &rect_cur, 26); PutBitmap3(&grcFull, 41 * gTS.select + (WINDOW_WIDTH + 102) / 2, WINDOW_HEIGHT - 86, &rect_cur, SURFACE_ID_TEXT_BOX);
} }
} }
@ -1233,7 +1233,7 @@ int TextScriptProc()
gTS.p_write = x; gTS.p_write = x;
//Print text //Print text
PutText2(0, 0, str, 0xFFFFFE, gTS.line % 4 + 30); PutText2(0, 0, str, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
sprintf(&text[gTS.line % 4 * 0x40], str); sprintf(&text[gTS.line % 4 * 0x40], str);
//Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping) //Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping)
@ -1263,11 +1263,11 @@ int TextScriptProc()
//Print text //Print text
if (c[0] == '=') if (c[0] == '=')
{ {
Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, gTS.line % 4 + 30, 26); Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1), SURFACE_ID_TEXT_BOX);
} }
else else
{ {
PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, gTS.line % 4 + 30); PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
} }
strcat(&text[gTS.line % 4 * 0x40], c); strcat(&text[gTS.line % 4 * 0x40], c);

View file

@ -131,12 +131,12 @@ void SetValueView(int *px, int *py, int value)
RECT rcMinus = {40, 48, 48, 56}; RECT rcMinus = {40, 48, 48, 56};
//Draw value //Draw value
CortBox2(&gVV[index].rect, 0x000000, 29); CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW);
if (minus) if (minus)
Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcMinus, 29, 26); Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcMinus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX);
else else
Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcPlus, 29, 26); Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcPlus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX);
for (int i = 3; i >= 0; i--) for (int i = 3; i >= 0; i--)
{ {
@ -181,7 +181,7 @@ void PutValueView(int flx, int fly)
(*gVV[v].px) / 0x200 - (gVV[v].rect.right - gVV[v].rect.left) / 2 - flx / 0x200, (*gVV[v].px) / 0x200 - (gVV[v].rect.right - gVV[v].rect.left) / 2 - flx / 0x200,
(*gVV[v].py) / 0x200 + gVV[v].offset_y / 0x200 - 4 - fly / 0x200, (*gVV[v].py) / 0x200 + gVV[v].offset_y / 0x200 - 4 - fly / 0x200,
&gVV[v].rect, &gVV[v].rect,
29); SURFACE_ID_VALUE_VIEW);
} }
} }
} }