Some orthograph corrections
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
052e018063
commit
70818bd58c
4 changed files with 43 additions and 46 deletions
82
src/Main.cpp
82
src/Main.cpp
|
@ -44,7 +44,7 @@ const char *lpWindowName = "洞窟物語エンジン2";
|
||||||
const char *lpWindowName = "Cave Story Engine 2 ~ Doukutsu Monogatari Enjin 2";
|
const char *lpWindowName = "Cave Story Engine 2 ~ Doukutsu Monogatari Enjin 2";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//A replication of MSVC's rand algorithm
|
// A replication of MSVC's rand algorithm
|
||||||
static unsigned long int next = 1;
|
static unsigned long int next = 1;
|
||||||
|
|
||||||
int rep_rand()
|
int rep_rand()
|
||||||
|
@ -58,7 +58,7 @@ void rep_srand(unsigned int seed)
|
||||||
next = seed;
|
next = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Framerate stuff
|
// Framerate stuff
|
||||||
void PutFramePerSecound()
|
void PutFramePerSecound()
|
||||||
{
|
{
|
||||||
if (bFps)
|
if (bFps)
|
||||||
|
@ -94,12 +94,12 @@ int GetFramePerSecound()
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//Get executable's path
|
// Get executable's path
|
||||||
strcpy(gModulePath, SDL_GetBasePath());
|
strcpy(gModulePath, SDL_GetBasePath());
|
||||||
if (gModulePath[strlen(gModulePath) - 1] == '/' || gModulePath[strlen(gModulePath) - 1] == '\\')
|
if (gModulePath[strlen(gModulePath) - 1] == '/' || gModulePath[strlen(gModulePath) - 1] == '\\')
|
||||||
gModulePath[strlen(gModulePath) - 1] = '\0'; //String cannot end in slash or stuff will probably break (original does this through a windows.h provided function)
|
gModulePath[strlen(gModulePath) - 1] = '\0'; // String cannot end in slash or stuff will probably break (original does this through a windows.h provided function)
|
||||||
|
|
||||||
//Get path of the data folder
|
// Get path of the data folder
|
||||||
strcpy(gDataPath, gModulePath);
|
strcpy(gDataPath, gModulePath);
|
||||||
strcat(gDataPath, "/data");
|
strcat(gDataPath, "/data");
|
||||||
|
|
||||||
|
@ -109,17 +109,17 @@ int main(int argc, char *argv[])
|
||||||
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
|
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Initialize SDL
|
// Initialize SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER) >= 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER) >= 0)
|
||||||
{
|
{
|
||||||
//Load configuration
|
// Load configuration
|
||||||
CONFIG config;
|
CONFIG config;
|
||||||
|
|
||||||
if (!LoadConfigData(&config))
|
if (!LoadConfigData(&config))
|
||||||
DefaultConfigData(&config);
|
DefaultConfigData(&config);
|
||||||
|
|
||||||
//Apply keybinds
|
// Apply keybinds
|
||||||
//Swap X and Z buttons
|
// Swap X and Z buttons
|
||||||
if (config.attack_button_mode)
|
if (config.attack_button_mode)
|
||||||
{
|
{
|
||||||
if (config.attack_button_mode == 1)
|
if (config.attack_button_mode == 1)
|
||||||
|
@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||||
gKeyShot = KEY_X;
|
gKeyShot = KEY_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Swap Okay and Cancel buttons
|
// Swap Okay and Cancel buttons
|
||||||
if (config.ok_button_mode)
|
if (config.ok_button_mode)
|
||||||
{
|
{
|
||||||
if (config.ok_button_mode == 1)
|
if (config.ok_button_mode == 1)
|
||||||
|
@ -149,14 +149,14 @@ int main(int argc, char *argv[])
|
||||||
gKeyCancel = gKeyShot;
|
gKeyCancel = gKeyShot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Swap left and right weapon switch keys
|
// Swap left and right weapon switch keys
|
||||||
if (CheckFileExists("s_reverse"))
|
if (CheckFileExists("s_reverse"))
|
||||||
{
|
{
|
||||||
gKeyArms = KEY_ARMSREV;
|
gKeyArms = KEY_ARMSREV;
|
||||||
gKeyArmsRev = KEY_ARMS;
|
gKeyArmsRev = KEY_ARMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Alternate movement keys
|
// Alternate movement keys
|
||||||
if (config.move_button_mode)
|
if (config.move_button_mode)
|
||||||
{
|
{
|
||||||
if (config.move_button_mode == 1)
|
if (config.move_button_mode == 1)
|
||||||
|
@ -175,7 +175,7 @@ int main(int argc, char *argv[])
|
||||||
gKeyDown = KEY_DOWN;
|
gKeyDown = KEY_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set gamepad inputs
|
// Set gamepad inputs
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
switch (config.joystick_button[i])
|
switch (config.joystick_button[i])
|
||||||
|
@ -211,7 +211,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
RECT unused_rect = {0, 0, 320, 240};
|
RECT unused_rect = {0, 0, 320, 240};
|
||||||
|
|
||||||
//Load cursor
|
// Load cursor
|
||||||
size_t size;
|
size_t size;
|
||||||
const unsigned char *data = FindResource("CURSOR_NORMAL", "CURSOR", &size);
|
const unsigned char *data = FindResource("CURSOR_NORMAL", "CURSOR", &size);
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ int main(int argc, char *argv[])
|
||||||
printf("Failed to load cursor\n");
|
printf("Failed to load cursor\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get window dimensions and colour depth
|
// Get window dimensions and color depth
|
||||||
int windowWidth;
|
int windowWidth;
|
||||||
int windowHeight;
|
int windowHeight;
|
||||||
int colourDepth;
|
int colourDepth;
|
||||||
|
@ -245,7 +245,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
//Set window dimensions
|
// Set window dimensions
|
||||||
if (config.display_mode == 1)
|
if (config.display_mode == 1)
|
||||||
{
|
{
|
||||||
windowWidth = WINDOW_WIDTH;
|
windowWidth = WINDOW_WIDTH;
|
||||||
|
@ -257,7 +257,7 @@ int main(int argc, char *argv[])
|
||||||
windowHeight = WINDOW_HEIGHT * 2;
|
windowHeight = WINDOW_HEIGHT * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create window
|
// Create window
|
||||||
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
||||||
|
|
||||||
if (gWindow)
|
if (gWindow)
|
||||||
|
@ -274,16 +274,16 @@ int main(int argc, char *argv[])
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
//Set window dimensions
|
// Set window dimensions
|
||||||
windowWidth = WINDOW_WIDTH * 2;
|
windowWidth = WINDOW_WIDTH * 2;
|
||||||
windowHeight = WINDOW_HEIGHT * 2;
|
windowHeight = WINDOW_HEIGHT * 2;
|
||||||
|
|
||||||
//Create window
|
// Create window
|
||||||
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
||||||
|
|
||||||
if (gWindow)
|
if (gWindow)
|
||||||
{
|
{
|
||||||
//Set colour depth
|
// Set color depth
|
||||||
switch (config.display_mode)
|
switch (config.display_mode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -306,17 +306,17 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create window
|
// Create window
|
||||||
|
|
||||||
|
|
||||||
if (gWindow)
|
if (gWindow)
|
||||||
{
|
{
|
||||||
//Check debug things
|
// Check debug things
|
||||||
if (CheckFileExists("fps"))
|
if (CheckFileExists("fps"))
|
||||||
bFps = true;
|
bFps = true;
|
||||||
|
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
//Load icon
|
// Load icon
|
||||||
size_t size;
|
size_t size;
|
||||||
const unsigned char *data = FindResource("ICON_MINI", "ICON", &size);
|
const unsigned char *data = FindResource("ICON_MINI", "ICON", &size);
|
||||||
|
|
||||||
|
@ -338,38 +338,38 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Set rects
|
// Set rects
|
||||||
RECT loading_rect = {0, 0, 64, 8};
|
RECT loading_rect = {0, 0, 64, 8};
|
||||||
RECT clip_rect = {0, 0, windowWidth, windowHeight};
|
RECT clip_rect = {0, 0, windowWidth, windowHeight};
|
||||||
|
|
||||||
//Load the "LOADING" text
|
// Load the "LOADING" text
|
||||||
MakeSurface_File("Loading", SURFACE_ID_LOADING);
|
MakeSurface_File("Loading", SURFACE_ID_LOADING);
|
||||||
|
|
||||||
//Draw loading screen
|
// Draw loading screen
|
||||||
CortBox(&clip_rect, 0x000000);
|
CortBox(&clip_rect, 0x000000);
|
||||||
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
|
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
|
||||||
|
|
||||||
//Draw to screen
|
// Draw to screen
|
||||||
if (Flip_SystemTask())
|
if (Flip_SystemTask())
|
||||||
{
|
{
|
||||||
//Initialize sound
|
// Initialize sound
|
||||||
InitDirectSound();
|
InitDirectSound();
|
||||||
|
|
||||||
//Initialize joystick
|
// Initialize joystick
|
||||||
if (config.bJoystick && InitDirectInput())
|
if (config.bJoystick && InitDirectInput())
|
||||||
{
|
{
|
||||||
ResetJoystickStatus();
|
ResetJoystickStatus();
|
||||||
gbUseJoystick = true;
|
gbUseJoystick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialize stuff
|
// Initialize stuff
|
||||||
InitTextObject(config.font_name);
|
InitTextObject(config.font_name);
|
||||||
InitTriangleTable();
|
InitTriangleTable();
|
||||||
|
|
||||||
//Run game code
|
// Run game code
|
||||||
Game();
|
Game();
|
||||||
|
|
||||||
//End stuff
|
// End stuff
|
||||||
EndDirectSound();
|
EndDirectSound();
|
||||||
EndTextObject();
|
EndTextObject();
|
||||||
EndDirectDraw();
|
EndDirectDraw();
|
||||||
|
@ -417,10 +417,10 @@ void JoystickProc()
|
||||||
|
|
||||||
if (GetJoystickStatus(&status))
|
if (GetJoystickStatus(&status))
|
||||||
{
|
{
|
||||||
//Clear held buttons
|
// Clear held buttons
|
||||||
gKey &= (KEY_ESCAPE | KEY_F2 | KEY_F1);
|
gKey &= (KEY_ESCAPE | KEY_F2 | KEY_F1);
|
||||||
|
|
||||||
//Set movement buttons
|
// Set movement buttons
|
||||||
if (status.bLeft)
|
if (status.bLeft)
|
||||||
gKey |= gKeyLeft;
|
gKey |= gKeyLeft;
|
||||||
if (status.bRight)
|
if (status.bRight)
|
||||||
|
@ -430,7 +430,7 @@ void JoystickProc()
|
||||||
if (status.bDown)
|
if (status.bDown)
|
||||||
gKey |= gKeyDown;
|
gKey |= gKeyDown;
|
||||||
|
|
||||||
//Set held buttons
|
// Set held buttons
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (status.bButton[i])
|
if (status.bButton[i])
|
||||||
|
@ -448,7 +448,7 @@ void JoystickProc()
|
||||||
|
|
||||||
bool SystemTask()
|
bool SystemTask()
|
||||||
{
|
{
|
||||||
//Handle window events
|
// Handle window events
|
||||||
bool focusGained = true;
|
bool focusGained = true;
|
||||||
|
|
||||||
while (SDL_PollEvent(NULL) || !focusGained)
|
while (SDL_PollEvent(NULL) || !focusGained)
|
||||||
|
@ -488,11 +488,9 @@ bool SystemTask()
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
//BUG FIX: Pixel relied on key codes for input, but these differ based on keyboard layout.
|
// BUG FIX: Pixel relied on key codes for input, but these differ based on keyboard layout.
|
||||||
//This would break the alternate movement keys on typical English keyboards, since the '=' key
|
// This would break the alternate movement keys on typical English keyboards, since the '=' key is in a completely different place to where it is on a Japanese keyboard.
|
||||||
//is in a completely different place to where it is on a Japanese keyboard.
|
// To solve this, we use scan codes instead, which are based on the physical location of keys, rather than their meaning.
|
||||||
//To solve this, we use scancodes instead, which are based on the physical location of keys,
|
|
||||||
//rather than their meaning.
|
|
||||||
switch (event.key.keysym.scancode)
|
switch (event.key.keysym.scancode)
|
||||||
{
|
{
|
||||||
case SDL_SCANCODE_ESCAPE:
|
case SDL_SCANCODE_ESCAPE:
|
||||||
|
@ -631,7 +629,7 @@ bool SystemTask()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Run joystick code
|
// Run joystick code
|
||||||
if (gbUseJoystick)
|
if (gbUseJoystick)
|
||||||
JoystickProc();
|
JoystickProc();
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Read tiledata
|
// Read tile data
|
||||||
fread(gMap.data, 1, gMap.length * gMap.width, fp);
|
fread(gMap.data, 1, gMap.length * gMap.width, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -80,12 +80,11 @@ void ReadyMapName(const char *str)
|
||||||
str = (char*)presentText;
|
str = (char*)presentText;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy map's name to the MapName
|
// Copy map's name to the global map name
|
||||||
strcpy(gMapName.name, str);
|
strcpy(gMapName.name, str);
|
||||||
|
|
||||||
// Draw the text to the surface
|
// Draw the text to the surface
|
||||||
a = (int)strlen(gMapName.name);
|
a = (int)strlen(gMapName.name);
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((160 - 6 * a) / 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((160 - 6 * a) / 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);
|
||||||
|
|
|
@ -225,7 +225,7 @@ void PutMyChar(int fx, int fy)
|
||||||
|
|
||||||
PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
|
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 air tank
|
||||||
RECT rcBubble[2] = {
|
RECT rcBubble[2] = {
|
||||||
{56, 96, 80, 120},
|
{56, 96, 80, 120},
|
||||||
{80, 96, 104, 120},
|
{80, 96, 104, 120},
|
||||||
|
|
Loading…
Add table
Reference in a new issue