Made MapName.cpp ASM-accurate
This commit is contained in:
parent
f3a2c96ce6
commit
8a569b127f
2 changed files with 80 additions and 20 deletions
|
@ -5,47 +5,105 @@
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
#include "CommonDefines.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
MAP_NAME gMapName;
|
MAP_NAME gMapName;
|
||||||
RECT rc = { 0, 0, 160, 12 };
|
RECT rc = { 0, 0, 160, 12 };
|
||||||
|
|
||||||
void ReadyMapName(const char *str)
|
void ReadyMapName(const char *str)
|
||||||
{
|
{
|
||||||
|
int a;
|
||||||
|
|
||||||
|
//Handle "Studio Pixel presents" text in the intro
|
||||||
|
unsigned char presentText[24] = {
|
||||||
|
#ifdef JAPANESE
|
||||||
|
// "ŠJ”ŽºPixel presents"
|
||||||
|
0x8A-1, // ŠJ
|
||||||
|
0x4A-1,
|
||||||
|
0x94-1, // ”
|
||||||
|
0xAD-1,
|
||||||
|
0x8E-1, // Žº
|
||||||
|
0xBA-1,
|
||||||
|
'P'-1,
|
||||||
|
'i'-1,
|
||||||
|
'x'-1,
|
||||||
|
'e'-1,
|
||||||
|
'l'-1,
|
||||||
|
' '-1,
|
||||||
|
'p'-1,
|
||||||
|
'r'-1,
|
||||||
|
'e'-1,
|
||||||
|
's'-1,
|
||||||
|
'e'-1,
|
||||||
|
'n'-1,
|
||||||
|
't'-1,
|
||||||
|
's'-1,
|
||||||
|
#else
|
||||||
|
// " Studio Pixel presents"
|
||||||
|
' '-1,
|
||||||
|
' '-1,
|
||||||
|
'S'-1,
|
||||||
|
't'-1,
|
||||||
|
'u'-1,
|
||||||
|
'd'-1,
|
||||||
|
'i'-1,
|
||||||
|
'o'-1,
|
||||||
|
' '-1,
|
||||||
|
'P'-1,
|
||||||
|
'i'-1,
|
||||||
|
'x'-1,
|
||||||
|
'e'-1,
|
||||||
|
'l'-1,
|
||||||
|
' '-1,
|
||||||
|
'p'-1,
|
||||||
|
'r'-1,
|
||||||
|
'e'-1,
|
||||||
|
's'-1,
|
||||||
|
'e'-1,
|
||||||
|
'n'-1,
|
||||||
|
't'-1,
|
||||||
|
's'-1,
|
||||||
|
#endif
|
||||||
|
0xFF
|
||||||
|
};
|
||||||
|
|
||||||
//Reset map name flags
|
//Reset map name flags
|
||||||
gMapName.flag = 0;
|
gMapName.flag = 0;
|
||||||
gMapName.wait = 0;
|
gMapName.wait = 0;
|
||||||
|
|
||||||
//Handle "Studio Pixel presents" text in the intro
|
|
||||||
#ifdef JAPANESE
|
|
||||||
char presentText[24] = "ŠJ”ŽºPixel presents";
|
|
||||||
#else
|
|
||||||
char presentText[24] = " Studio Pixel presents";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!strcmp(str, "u"))
|
if (!strcmp(str, "u"))
|
||||||
{
|
{
|
||||||
/*for (i = 0; i < strlen(presentText); i++) //No need for this, we aren't encrypting the text
|
for (a = 0; a < (int)sizeof(presentText); ++a)
|
||||||
++studio_pixel_presents_string[i];*/
|
presentText[a] = presentText[a] + 1;
|
||||||
str = presentText;
|
|
||||||
|
str = (char*)presentText;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy map's name to the MapName
|
//Copy map's name to the MapName
|
||||||
strcpy(gMapName.name, str);
|
strcpy(gMapName.name, str);
|
||||||
|
|
||||||
//Draw the text to the surface
|
//Draw the text to the surface
|
||||||
int len = (int)strlen(gMapName.name);
|
a = (int)strlen(gMapName.name);
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * a) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * a) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PutMapName(bool bMini)
|
void PutMapName(BOOL bMini)
|
||||||
{
|
{
|
||||||
|
// 'unused_rect' isn't the original name. The Linux port optimised this out, so there's no name for it.
|
||||||
|
RECT unused_rect = {0, 0, 160, 16};
|
||||||
|
|
||||||
if (bMini)
|
if (bMini)
|
||||||
{
|
{
|
||||||
//Map system
|
//Map system
|
||||||
RECT rcBack = {0, 7, WINDOW_WIDTH, 24};
|
RECT rcBack;
|
||||||
|
rcBack.left = 0;
|
||||||
|
rcBack.right = WINDOW_WIDTH;
|
||||||
|
rcBack.top = 7;
|
||||||
|
rcBack.bottom = 24;
|
||||||
|
|
||||||
CortBox(&rcBack, 0x000000);
|
CortBox(&rcBack, 0x000000);
|
||||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME);
|
||||||
}
|
}
|
||||||
|
@ -69,6 +127,6 @@ void RestoreMapName()
|
||||||
int len = (int)strlen(gMapName.name);
|
int len = (int)strlen(gMapName.name);
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * len) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * len) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
struct MAP_NAME
|
struct MAP_NAME
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
|
@ -8,6 +10,6 @@ struct MAP_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
void ReadyMapName(const char *str);
|
void ReadyMapName(const char *str);
|
||||||
void PutMapName(bool bMini);
|
void PutMapName(BOOL bMini);
|
||||||
void StartMapName();
|
void StartMapName();
|
||||||
void RestoreMapName();
|
void RestoreMapName();
|
||||||
|
|
Loading…
Add table
Reference in a new issue