Merge branch 'master' of https://github.com/cuckydev/Cave-Story-Engine-2
This commit is contained in:
commit
20dbf8a2c8
5 changed files with 116 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
/obj
|
/obj
|
||||||
Config.dat
|
*.dat
|
||||||
*rofile.dat
|
*.rec
|
||||||
build.7z
|
build.7z
|
||||||
build.zip
|
build.zip
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,22 @@
|
||||||
#include "KeyControl.h"
|
#include "KeyControl.h"
|
||||||
#include "Escape.h"
|
#include "Escape.h"
|
||||||
#include "Organya.h"
|
#include "Organya.h"
|
||||||
|
#include "MycParam.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
#include "Stage.h"
|
#include "Stage.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "TextScr.h"
|
#include "TextScr.h"
|
||||||
|
|
||||||
|
#define MAX_STRIP 0x10
|
||||||
|
|
||||||
CREDIT Credit;
|
CREDIT Credit;
|
||||||
STRIP Strip[16];
|
STRIP Strip[MAX_STRIP];
|
||||||
ILLUSTRATION Illust;
|
ILLUSTRATION Illust;
|
||||||
|
|
||||||
//Update casts
|
//Update casts
|
||||||
void ActionStripper()
|
void ActionStripper()
|
||||||
{
|
{
|
||||||
for (int s = 0; s < 16; s++)
|
for (int s = 0; s < MAX_STRIP; s++)
|
||||||
{
|
{
|
||||||
//Move up
|
//Move up
|
||||||
if (Strip[s].flag & 0x80 && Credit.mode)
|
if (Strip[s].flag & 0x80 && Credit.mode)
|
||||||
|
@ -37,7 +40,7 @@ void ActionStripper()
|
||||||
//Draw casts
|
//Draw casts
|
||||||
void PutStripper()
|
void PutStripper()
|
||||||
{
|
{
|
||||||
for (int s = 0; s < 16; s++)
|
for (int s = 0; s < MAX_STRIP; s++)
|
||||||
{
|
{
|
||||||
if (Strip[s].flag & 0x80)
|
if (Strip[s].flag & 0x80)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +61,7 @@ void PutStripper()
|
||||||
//Create a cast object
|
//Create a cast object
|
||||||
void SetStripper(int x, int y, char *text, int cast)
|
void SetStripper(int x, int y, char *text, int cast)
|
||||||
{
|
{
|
||||||
for (int s = 0; s < 16; s++)
|
for (int s = 0; s < MAX_STRIP; s++)
|
||||||
{
|
{
|
||||||
if (!(Strip[s].flag & 0x80))
|
if (!(Strip[s].flag & 0x80))
|
||||||
{
|
{
|
||||||
|
@ -81,7 +84,7 @@ void SetStripper(int x, int y, char *text, int cast)
|
||||||
//Regenerate cast text
|
//Regenerate cast text
|
||||||
void RestoreStripper()
|
void RestoreStripper()
|
||||||
{
|
{
|
||||||
for (int s = 0; s < 16; s++)
|
for (int s = 0; s < MAX_STRIP; s++)
|
||||||
{
|
{
|
||||||
if (Strip[s].flag & 0x80)
|
if (Strip[s].flag & 0x80)
|
||||||
{
|
{
|
||||||
|
@ -436,7 +439,7 @@ int Scene_DownIsland(int mode)
|
||||||
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, 21);
|
||||||
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, 21);
|
||||||
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, 21);
|
||||||
//PutTimeCounter(16, 8);
|
PutTimeCounter(16, 8);
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask())
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "Caret.h"
|
#include "Caret.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
#include "MycParam.h"
|
||||||
#include "MapName.h"
|
#include "MapName.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "Organya.h"
|
#include "Organya.h"
|
||||||
|
@ -258,7 +259,7 @@ int ModeTitle()
|
||||||
bContinue = IsProfile();
|
bContinue = IsProfile();
|
||||||
|
|
||||||
//Set character
|
//Set character
|
||||||
time_counter = 0;//LoadTimeCounter();
|
time_counter = LoadTimeCounter();
|
||||||
|
|
||||||
if (time_counter && time_counter < 18000)
|
if (time_counter && time_counter < 18000)
|
||||||
char_type = 1;
|
char_type = 1;
|
||||||
|
@ -395,8 +396,8 @@ int ModeTitle()
|
||||||
//Draw carets
|
//Draw carets
|
||||||
PutCaret(0, 0);
|
PutCaret(0, 0);
|
||||||
|
|
||||||
//if (time_counter)
|
if (time_counter)
|
||||||
// PutTimeCounter(16, 8);
|
PutTimeCounter(16, 8);
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
|
|
||||||
|
@ -569,6 +570,7 @@ int ModeAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
PutMapName(false);
|
PutMapName(false);
|
||||||
|
PutTimeCounter(16, 8);
|
||||||
|
|
||||||
if (g_GameFlags & 2)
|
if (g_GameFlags & 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "MycParam.h"
|
#include "MycParam.h"
|
||||||
#include "NpChar.h"
|
#include "NpChar.h"
|
||||||
#include "CommonDefines.h"
|
#include "CommonDefines.h"
|
||||||
|
#include "Tags.h"
|
||||||
#include "ArmsItem.h"
|
#include "ArmsItem.h"
|
||||||
#include "ValueView.h"
|
#include "ValueView.h"
|
||||||
#include "TextScr.h"
|
#include "TextScr.h"
|
||||||
|
@ -28,6 +29,8 @@ ARMS_LEVEL gArmsLevelTable[14] =
|
||||||
{{40, 60, 200}}
|
{{40, 60, 200}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int time_count;
|
||||||
|
|
||||||
void AddExpMyChar(int x)
|
void AddExpMyChar(int x)
|
||||||
{
|
{
|
||||||
int lv = gArmsData[gSelectedArms].level - 1;
|
int lv = gArmsData[gSelectedArms].level - 1;
|
||||||
|
@ -341,3 +344,90 @@ void PutMyAir(int x, int y)
|
||||||
PutBitmap3(&grcGame, x, y, &rcAir[0], 26);
|
PutBitmap3(&grcGame, x, y, &rcAir[0], 26);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PutTimeCounter(int x, int y)
|
||||||
|
{
|
||||||
|
RECT rcTime[3];
|
||||||
|
rcTime[0] = {112, 104, 120, 112};
|
||||||
|
rcTime[1] = {120, 104, 128, 112};
|
||||||
|
rcTime[2] = {128, 104, 160, 112};
|
||||||
|
|
||||||
|
if (gMC.equip & 0x100)
|
||||||
|
{
|
||||||
|
//Draw clock and increase time
|
||||||
|
if (g_GameFlags & 2)
|
||||||
|
{
|
||||||
|
if (time_count < 300000)
|
||||||
|
++time_count;
|
||||||
|
|
||||||
|
if (time_count % 30 <= 10)
|
||||||
|
PutBitmap3(&grcGame, x, y, &rcTime[1], 26);
|
||||||
|
else
|
||||||
|
PutBitmap3(&grcGame, x, y, &rcTime[0], 26);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PutBitmap3(&grcGame, x, y, &rcTime[0], 26);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Draw time
|
||||||
|
PutNumber4(x, y, time_count / 3000, false);
|
||||||
|
PutNumber4(x + 20, y, time_count / 50 % 60, true);
|
||||||
|
PutNumber4(x + 32, y, time_count / 5 % 10, false);
|
||||||
|
PutBitmap3(&grcGame, x + 30, y, &rcTime[2], 26);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int LoadTimeCounter()
|
||||||
|
{
|
||||||
|
//Open file
|
||||||
|
char path[PATH_LENGTH];
|
||||||
|
sprintf(path, "%s/290.rec", gModulePath);
|
||||||
|
|
||||||
|
SDL_RWops *fp = SDL_RWFromFile(path, "rb");
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
REC rec;
|
||||||
|
|
||||||
|
//Read data
|
||||||
|
rec.counter[0] = SDL_ReadLE32(fp);
|
||||||
|
rec.counter[1] = SDL_ReadLE32(fp);
|
||||||
|
rec.counter[2] = SDL_ReadLE32(fp);
|
||||||
|
rec.counter[3] = SDL_ReadLE32(fp);
|
||||||
|
rec.random[0] = SDL_ReadU8(fp);
|
||||||
|
rec.random[1] = SDL_ReadU8(fp);
|
||||||
|
rec.random[2] = SDL_ReadU8(fp);
|
||||||
|
rec.random[3] = SDL_ReadU8(fp);
|
||||||
|
SDL_RWclose(fp);
|
||||||
|
|
||||||
|
//HACK: this swaps the random values to correspond to the correct bytes
|
||||||
|
*((uint32_t*)rec.random) = SDL_SwapLE32(*((uint32_t*)rec.random));
|
||||||
|
|
||||||
|
//Decode from checksum
|
||||||
|
uint8_t *p;
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
p = (uint8_t*)&rec.counter[i];
|
||||||
|
p[0] -= rec.random[i];
|
||||||
|
p[1] -= rec.random[i];
|
||||||
|
p[2] -= rec.random[i];
|
||||||
|
p[3] -= rec.random[i] >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Verify checksum's result
|
||||||
|
if (rec.counter[0] == rec.counter[1] && rec.counter[0] == rec.counter[2])
|
||||||
|
{
|
||||||
|
time_count = rec.counter[0];
|
||||||
|
return rec.counter[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time_count = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
struct ARMS_LEVEL
|
struct ARMS_LEVEL
|
||||||
{
|
{
|
||||||
int exp[3];
|
int exp[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct REC
|
||||||
|
{
|
||||||
|
int32_t counter[4];
|
||||||
|
uint8_t random[4];
|
||||||
|
};
|
||||||
|
|
||||||
extern ARMS_LEVEL gArmsLevelTable[14];
|
extern ARMS_LEVEL gArmsLevelTable[14];
|
||||||
|
|
||||||
void AddExpMyChar(int x);
|
void AddExpMyChar(int x);
|
||||||
|
@ -18,3 +25,6 @@ void PutArmsEnergy(bool flash);
|
||||||
void PutActiveArmsList();
|
void PutActiveArmsList();
|
||||||
void PutMyLife(bool flash);
|
void PutMyLife(bool flash);
|
||||||
void PutMyAir(int x, int y);
|
void PutMyAir(int x, int y);
|
||||||
|
void PutTimeCounter(int x, int y);
|
||||||
|
|
||||||
|
int LoadTimeCounter();
|
||||||
|
|
Loading…
Add table
Reference in a new issue