Merge pull request #12 from Clownacy/master
Merge Clownacy/master into master
This commit is contained in:
commit
4680607e59
23 changed files with 263 additions and 223 deletions
|
@ -11,6 +11,14 @@ name = "InitBack"
|
|||
addr = 0x402270
|
||||
size = 0x100
|
||||
|
||||
[[func]]
|
||||
name = "ActBack"
|
||||
addr = 0x402370
|
||||
|
||||
[[func]]
|
||||
name = "PutBack"
|
||||
addr = 0x4023D0
|
||||
|
||||
[[func]]
|
||||
name = "PutFront"
|
||||
addr = 0x402830
|
||||
|
@ -271,6 +279,14 @@ addr = 0x40ABC0
|
|||
name = "SetCaret"
|
||||
addr = 0x40AC90
|
||||
|
||||
[[func]]
|
||||
name = "LoadConfigData"
|
||||
addr = 0x40AD60
|
||||
|
||||
[[func]]
|
||||
name = "DefaultConfigData"
|
||||
addr = 0x40AE30
|
||||
|
||||
[[func]]
|
||||
name = "Call_Escape"
|
||||
addr = 0x40DD70
|
||||
|
@ -606,6 +622,18 @@ addr = 0x41FE70
|
|||
name = "PlaySoundObject"
|
||||
addr = 0x420640
|
||||
|
||||
[[func]]
|
||||
name = "TransferStage"
|
||||
addr = 0x420BE0
|
||||
|
||||
[[func]]
|
||||
name = "ChangeMusic"
|
||||
addr = 0x420EE0
|
||||
|
||||
[[func]]
|
||||
name = "ReCallMusic"
|
||||
addr = 0x420F50
|
||||
|
||||
[[func]]
|
||||
name = "InitStar"
|
||||
addr = 0x420FA0
|
||||
|
|
|
@ -38,8 +38,8 @@ BOOL InitBack(const char *fName, int type)
|
|||
// This is ridiculously platform-dependant:
|
||||
// It should break on big-endian CPUs, and platforms
|
||||
// where short isn't 16-bit and long isn't 32-bit.
|
||||
short bmp_header_buffer[7];
|
||||
long bmp_header_buffer2[10];
|
||||
unsigned short bmp_header_buffer[7]; // These names aren't the original. This ruins the stack frame layout.
|
||||
unsigned long bmp_header_buffer2[10];
|
||||
|
||||
fread(bmp_header_buffer, 14, 1, fp);
|
||||
|
||||
|
|
|
@ -469,8 +469,7 @@ void ActCaret17(CARET *crt)
|
|||
}
|
||||
|
||||
// Tables
|
||||
CARET_TABLE gCaretTable[18] =
|
||||
{
|
||||
CARET_TABLE gCaretTable[18] = {
|
||||
{0, 0},
|
||||
{0x800, 0x800},
|
||||
{0x1000, 0x1000},
|
||||
|
|
|
@ -11,21 +11,27 @@
|
|||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
bool LoadConfigData(CONFIG *conf)
|
||||
static const char* const config_filename = "Config.dat"; // Not the original name
|
||||
static const char* const config_magic = "DOUKUTSU20041206"; // Not the original name
|
||||
|
||||
BOOL LoadConfigData(CONFIG *conf)
|
||||
{
|
||||
//Clear old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, "Config.dat");
|
||||
sprintf(path, "%s/%s", gModulePath, config_filename);
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read data
|
||||
#ifdef NONPORTABLE
|
||||
size_t fread_result = fread(conf, sizeof(CONFIG), 1, fp); // Not the original name
|
||||
#else
|
||||
//Read the version id and font name
|
||||
fread(conf->proof, sizeof(conf->proof), 1, fp);
|
||||
fread(conf->font_name, sizeof(conf->font_name), 1, fp);
|
||||
|
@ -42,23 +48,33 @@ bool LoadConfigData(CONFIG *conf)
|
|||
conf->bJoystick = File_ReadLE32(fp);
|
||||
for (int button = 0; button < 8; button++)
|
||||
conf->joystick_button[button] = File_ReadLE32(fp);
|
||||
#endif
|
||||
|
||||
//Close file
|
||||
fclose(fp);
|
||||
|
||||
//Check if version is correct, return that it succeeded
|
||||
if (!strcmp(conf->proof, "DOUKUTSU20041206"))
|
||||
return true;
|
||||
//Check if version is not correct, and return if it failed
|
||||
#ifdef NONPORTABLE
|
||||
if (fread_result != 1 || strcmp(conf->proof, config_magic))
|
||||
#else
|
||||
if (strcmp(conf->proof, config_magic))
|
||||
#endif
|
||||
{
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//If not, return that it failed
|
||||
return false;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DefaultConfigData(CONFIG *conf)
|
||||
{
|
||||
//Claer old config data
|
||||
//Clear old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//Fun fact: The Linux port added this line:
|
||||
//conf->display_mode = 1;
|
||||
|
||||
//Reset joystick settings (as these can't simply be set to 0)
|
||||
conf->bJoystick = 1;
|
||||
conf->joystick_button[0] = 2;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
struct CONFIG
|
||||
{
|
||||
char proof[0x20];
|
||||
|
@ -14,5 +16,5 @@ struct CONFIG
|
|||
int32_t joystick_button[8];
|
||||
};
|
||||
|
||||
bool LoadConfigData(CONFIG *conf);
|
||||
BOOL LoadConfigData(CONFIG *conf);
|
||||
void DefaultConfigData(CONFIG *conf);
|
||||
|
|
|
@ -441,7 +441,6 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_
|
|||
|
||||
// Get SDL_Rects
|
||||
SDL_Rect clipRect = RectToSDLRectScaled(rcView);
|
||||
|
||||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
// Get dest rect
|
||||
|
@ -568,10 +567,13 @@ void InitTextObject(const char *font_name)
|
|||
fontHeight = 12;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
{
|
||||
fontWidth = 5 * magnification;
|
||||
fontHeight = 10 * magnification;
|
||||
}*/
|
||||
|
||||
fontWidth = 5 * magnification;
|
||||
fontHeight = 10 * magnification;
|
||||
// }
|
||||
|
||||
size_t data_size;
|
||||
#ifdef WINDOWS
|
||||
|
|
|
@ -170,7 +170,7 @@ bool StartCreditScript()
|
|||
if (Credit.size == -1)
|
||||
return false;
|
||||
|
||||
//Allcoate buffer data
|
||||
// Allocate buffer data
|
||||
Credit.pData = (char*)malloc(Credit.size);
|
||||
if (Credit.pData == NULL)
|
||||
return false;
|
||||
|
@ -276,7 +276,7 @@ void ActionCredit_Read()
|
|||
{
|
||||
if (Credit.pData[Credit.offset] == 'l')
|
||||
{
|
||||
//what is this
|
||||
// What is this
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
if (b == a)
|
||||
|
|
|
@ -33,7 +33,7 @@ struct ISLAND_SPRITE
|
|||
int y;
|
||||
};
|
||||
|
||||
#define MAX_STRIP (WINDOW_HEIGHT / 16) + 1
|
||||
#define MAX_STRIP ((WINDOW_HEIGHT / 16) + 1)
|
||||
|
||||
void ActionStripper();
|
||||
void PutStripper();
|
||||
|
|
|
@ -81,7 +81,7 @@ BOOL LoadMapData2(const char *path_map)
|
|||
BOOL LoadAttributeData(const char *path_atrb)
|
||||
{
|
||||
//Open file
|
||||
char path[260];
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gDataPath, path_atrb);
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
|
|
@ -53,14 +53,14 @@ void SetUniqueParameter(NPCHAR *npc)
|
|||
npc->view.bottom = gNpcTable[code].view.bottom << 9;
|
||||
}
|
||||
|
||||
bool LoadEvent(const char *path_event)
|
||||
BOOL LoadEvent(const char *path_event)
|
||||
{
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gDataPath, path_event);
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read "PXE" check
|
||||
char code[4];
|
||||
|
@ -71,7 +71,7 @@ bool LoadEvent(const char *path_event)
|
|||
// The original game forgot to close the file here
|
||||
fclose(fp);
|
||||
#endif
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//Get amount of NPCs
|
||||
|
@ -128,7 +128,7 @@ bool LoadEvent(const char *path_event)
|
|||
}
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc, int start_index)
|
||||
|
@ -235,7 +235,7 @@ void SetExpObjects(int x, int y, int exp)
|
|||
}
|
||||
}
|
||||
|
||||
bool SetBulletObject(int x, int y, int val)
|
||||
BOOL SetBulletObject(int x, int y, int val)
|
||||
{
|
||||
int tamakazu_ari[10];
|
||||
|
||||
|
@ -254,7 +254,7 @@ bool SetBulletObject(int x, int y, int val)
|
|||
}
|
||||
|
||||
if (!t)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
n = Random(1, 10 * t);
|
||||
int bullet_no = tamakazu_ari[n % t];
|
||||
|
@ -272,14 +272,14 @@ bool SetBulletObject(int x, int y, int val)
|
|||
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
|
||||
gNPC[n].exp = val;
|
||||
SetUniqueParameter(&gNPC[n]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool SetLifeObject(int x, int y, int val)
|
||||
BOOL SetLifeObject(int x, int y, int val)
|
||||
{
|
||||
for (int n = 0x100; n < NPC_MAX; n++)
|
||||
{
|
||||
|
@ -294,11 +294,11 @@ bool SetLifeObject(int x, int y, int val)
|
|||
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
|
||||
gNPC[n].exp = val;
|
||||
SetUniqueParameter(&gNPC[n]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void VanishNpChar(NPCHAR *npc)
|
||||
|
|
|
@ -83,13 +83,13 @@ extern int gSuperXpos;
|
|||
extern int gSuperYpos;
|
||||
|
||||
void InitNpChar();
|
||||
bool LoadEvent(const char *path_event);
|
||||
BOOL LoadEvent(const char *path_event);
|
||||
void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc, int start_index);
|
||||
void SetDestroyNpChar(int x, int y, int w, int num);
|
||||
void SetDestroyNpCharUp(int x, int y, int w, int num);
|
||||
void SetExpObjects(int x, int y, int exp);
|
||||
bool SetBulletObject(int x, int y, int val);
|
||||
bool SetLifeObject(int x, int y, int val);
|
||||
BOOL SetBulletObject(int x, int y, int val);
|
||||
BOOL SetLifeObject(int x, int y, int val);
|
||||
void VanishNpChar(NPCHAR *npc);
|
||||
void PutNpChar(int fx, int fy);
|
||||
void ActNpChar();
|
||||
|
|
|
@ -132,7 +132,7 @@ const STAGE_TABLE gTMT[95] = {
|
|||
BOOL TransferStage(int no, int w, int x, int y)
|
||||
{
|
||||
//Move character
|
||||
SetMyCharPosition(x << 13, y << 13);
|
||||
SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200);
|
||||
|
||||
BOOL bError = FALSE;
|
||||
|
||||
|
@ -166,7 +166,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
bError = TRUE;
|
||||
|
||||
//Load background
|
||||
strcpy(path, gTMT[no].back);
|
||||
sprintf(path, "%s", gTMT[no].back);
|
||||
if (!InitBack(path, gTMT[no].bkType))
|
||||
bError = TRUE;
|
||||
|
||||
|
@ -183,12 +183,8 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
bError = TRUE;
|
||||
|
||||
if (bError)
|
||||
{
|
||||
printf("Failed to load stage %d\n", no);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//Load map name
|
||||
ReadyMapName(gTMT[no].name);
|
||||
|
||||
|
@ -204,9 +200,6 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//Music
|
||||
const char *gMusicTable[42] =
|
||||
{
|
||||
|
@ -264,8 +257,9 @@ int gMusicNo;
|
|||
|
||||
void ChangeMusic(int no)
|
||||
{
|
||||
if (!no || no != gMusicNo)
|
||||
{
|
||||
if (no && no == gMusicNo)
|
||||
return;
|
||||
|
||||
//Stop and keep track of old song
|
||||
gOldPos = GetOrganyaPosition();
|
||||
gOldNo = gMusicNo;
|
||||
|
@ -280,7 +274,6 @@ void ChangeMusic(int no)
|
|||
PlayOrganyaMusic();
|
||||
gMusicNo = no;
|
||||
}
|
||||
}
|
||||
|
||||
void ReCallMusic()
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ void EncryptionBinaryData2(uint8_t *pData, int size)
|
|||
}
|
||||
|
||||
//Load generic .tsc
|
||||
bool LoadTextScript2(const char *name)
|
||||
BOOL LoadTextScript2(const char *name)
|
||||
{
|
||||
//Get path
|
||||
char path[260];
|
||||
|
@ -120,12 +120,12 @@ bool LoadTextScript2(const char *name)
|
|||
|
||||
gTS.size = GetFileSizeLong(path);
|
||||
if (gTS.size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read data
|
||||
fread(gTS.data, 1, gTS.size, fp);
|
||||
|
@ -137,11 +137,11 @@ bool LoadTextScript2(const char *name)
|
|||
|
||||
//Decrypt data
|
||||
EncryptionBinaryData2((uint8_t*)gTS.data, gTS.size);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Load stage .tsc
|
||||
bool LoadTextScript_Stage(const char *name)
|
||||
BOOL LoadTextScript_Stage(const char *name)
|
||||
{
|
||||
//Open Head.tsc
|
||||
char path[PATH_LENGTH];
|
||||
|
@ -149,11 +149,11 @@ bool LoadTextScript_Stage(const char *name)
|
|||
|
||||
long head_size = GetFileSizeLong(path);
|
||||
if (head_size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read Head.tsc
|
||||
fread(gTS.data, 1, head_size, fp);
|
||||
|
@ -166,11 +166,11 @@ bool LoadTextScript_Stage(const char *name)
|
|||
|
||||
long body_size = GetFileSizeLong(path);
|
||||
if (body_size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read stage's tsc
|
||||
fread(&gTS.data[head_size], 1, body_size, fp);
|
||||
|
@ -181,7 +181,7 @@ bool LoadTextScript_Stage(const char *name)
|
|||
//Set parameters
|
||||
gTS.size = head_size + body_size;
|
||||
strcpy(gTS.path, name);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Get current path
|
||||
|
|
|
@ -60,8 +60,8 @@ struct TEXT_SCRIPT
|
|||
BOOL InitTextScript2();
|
||||
void EndTextScript();
|
||||
void EncryptionBinaryData2(uint8_t *pData, int size);
|
||||
bool LoadTextScript2(const char *name);
|
||||
bool LoadTextScript_Stage(const char *name);
|
||||
BOOL LoadTextScript2(const char *name);
|
||||
BOOL LoadTextScript_Stage(const char *name);
|
||||
void GetTextScriptPath(char *path);
|
||||
BOOL StartTextScript(int no);
|
||||
void StopTextScript();
|
||||
|
|
Loading…
Add table
Reference in a new issue