mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-22 22:58:12 +03:00
Add some helper functions to GameId
This commit is contained in:
+2
-2
@@ -62,7 +62,7 @@ SDL_Texture* create_scanline_texture(SDL_Renderer* renderer, int width, int heig
|
||||
AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id), dirty(false)
|
||||
{
|
||||
// 画面サイズ
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG) {
|
||||
if (game_id.is_gakuen()) {
|
||||
window_width = 582;
|
||||
screen_width = 512;
|
||||
window_height = screen_height = 424;
|
||||
@@ -619,7 +619,7 @@ void AGS::save_screenshot(const char* path)
|
||||
int AGS::calculate_menu_max(int window) {
|
||||
if (game_id.crc32_a == CRC32_INTRUDER)
|
||||
return 6;
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG)
|
||||
if (game_id.is_gakuen())
|
||||
return (menu_w[window - 1].ey - menu_w[window - 1].sy) / (menu_font_size + 4);
|
||||
return 11;
|
||||
}
|
||||
|
||||
+2
-10
@@ -41,11 +41,7 @@ void AGS::load_pms(uint8* data, int page, int transparent)
|
||||
tmp_palette[i * 16 + j] = SETPALETTE256(r, g, b);
|
||||
}
|
||||
}
|
||||
if (game_id.crc32_a == CRC32_RANCE41 ||
|
||||
game_id.crc32_a == CRC32_RANCE41_ENG ||
|
||||
game_id.crc32_a == CRC32_RANCE42 ||
|
||||
game_id.crc32_a == CRC32_RANCE42_ENG ||
|
||||
game_id.crc32_a == CRC32_HASHIRIONNA2) {
|
||||
if (game_id.is_rance4x() || game_id.crc32_a == CRC32_HASHIRIONNA2) {
|
||||
// 上下16色は取得しない
|
||||
for(int i = 1; i < 15; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
@@ -77,11 +73,7 @@ void AGS::load_pms(uint8* data, int page, int transparent)
|
||||
// パレット展開
|
||||
if (game_id.sys_ver == 3) {
|
||||
if ((extract_palette && extract_palette_cg[page]) || game_id.crc32_a == CRC32_FUNNYBEE_CD) {
|
||||
if (game_id.crc32_a == CRC32_RANCE41 ||
|
||||
game_id.crc32_a == CRC32_RANCE41_ENG ||
|
||||
game_id.crc32_a == CRC32_RANCE42 ||
|
||||
game_id.crc32_a == CRC32_RANCE42_ENG ||
|
||||
game_id.crc32_a == CRC32_HASHIRIONNA2) {
|
||||
if (game_id.is_rance4x() || game_id.crc32_a == CRC32_HASHIRIONNA2) {
|
||||
// 上下16色は展開しない
|
||||
for(int i = 1; i < 15; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
|
||||
+2
-2
@@ -143,7 +143,7 @@ void AGS::load_vsp(uint8* data, int page, int transparent)
|
||||
|
||||
uint32* dest;
|
||||
// Gakuen Senki uses exact sx values rather than 8x.
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG)
|
||||
if (game_id.is_gakuen())
|
||||
dest = &vram[dest_screen][y + sy][(x * 8) + sx];
|
||||
else
|
||||
dest = &vram[dest_screen][y + sy][(x + sx) * 8];
|
||||
@@ -165,7 +165,7 @@ void AGS::load_vsp(uint8* data, int page, int transparent)
|
||||
|
||||
// 画面更新
|
||||
if(dest_screen == 0 && extract_cg) {
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG) {
|
||||
if (game_id.is_gakuen()) {
|
||||
// Gakuen Senki's images were converted to VSP for the modern port, but don't always adhere to VSP's width restrictions, which demand
|
||||
// every image width be a factor of 8. Thankfully, the exceptions are designed to fit into specific parts of the GUI, and so have
|
||||
// consistent widths for each output position.
|
||||
|
||||
+4
-4
@@ -57,12 +57,12 @@ std::vector<uint8> Dri::load(int page)
|
||||
}
|
||||
|
||||
// static
|
||||
std::vector<uint8> Dri::load_mda(uint32_t crc32_a, uint32_t crc32_b, int page)
|
||||
std::vector<uint8> Dri::load_mda(const GameId& game_id, int page)
|
||||
{
|
||||
// データ取得
|
||||
const char* name = NULL;
|
||||
|
||||
switch(crc32_a) {
|
||||
switch (game_id.crc32_a) {
|
||||
case CRC32_BUNKASAI: // あぶない文化祭前夜
|
||||
name = "AMUS_AB.MDA";
|
||||
break;
|
||||
@@ -206,7 +206,7 @@ std::vector<uint8> Dri::load_mda(uint32_t crc32_a, uint32_t crc32_b, int page)
|
||||
// AMUS.MDA以外にリンクされている場合はリソースを開き直す
|
||||
if(disk_index == 2) {
|
||||
SDL_RWclose(rw);
|
||||
switch(crc32_b) {
|
||||
switch (game_id.crc32_b) {
|
||||
case CRC32_DPS_SG_FAHREN: // D.P.S. SG - Fahren Fliegen
|
||||
name = "BMUS_FAH";
|
||||
break;
|
||||
@@ -255,7 +255,7 @@ std::vector<uint8> Dri::load_mda(uint32_t crc32_a, uint32_t crc32_b, int page)
|
||||
}
|
||||
} else if(disk_index == 3) {
|
||||
SDL_RWclose(rw);
|
||||
switch(crc32_a) {
|
||||
switch (game_id.crc32_a) {
|
||||
case CRC32_TOUSHIN_HINT: // 闘神都市 ヒントディスク
|
||||
name = "CMUS_T1";
|
||||
break;
|
||||
|
||||
+3
-1
@@ -11,12 +11,14 @@
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
struct GameId;
|
||||
|
||||
class Dri {
|
||||
public:
|
||||
void open(const char* file_name);
|
||||
std::vector<uint8_t> load(int page);
|
||||
|
||||
static std::vector<uint8_t> load_mda(uint32_t crc32_a, uint32_t crc32_b, int page);
|
||||
static std::vector<uint8_t> load_mda(const GameId& game_id, int page);
|
||||
|
||||
private:
|
||||
std::string fname;
|
||||
|
||||
@@ -91,6 +91,16 @@ struct GameId {
|
||||
const char* encoding;
|
||||
|
||||
explicit GameId(const Config& config);
|
||||
bool is_gakuen() const {
|
||||
return crc32_a == CRC32_GAKUEN || crc32_a == CRC32_GAKUEN_ENG;
|
||||
}
|
||||
bool is_system1_dps() const {
|
||||
return crc32_a == CRC32_DPS || crc32_a == CRC32_DPS_SG || crc32_a == CRC32_DPS_SG2 || crc32_a == CRC32_DPS_SG3;
|
||||
}
|
||||
bool is_rance4x() const {
|
||||
return crc32_a == CRC32_RANCE41 || crc32_a == CRC32_RANCE42 ||
|
||||
crc32_a == CRC32_RANCE41_ENG || crc32_a == CRC32_RANCE42_ENG;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _GAMEID_H_
|
||||
|
||||
@@ -94,7 +94,7 @@ void stop_midi()
|
||||
class Playback {
|
||||
public:
|
||||
static std::unique_ptr<Playback> create(const GameId& game_id, Dri& amus, Dri& mda, int page, int loop, int seq);
|
||||
Playback(uint32_t crc32_a, int loop, int seq) : crc32_a(crc32_a), loop_(loop), seq_(seq) {}
|
||||
Playback(const GameId& game_id, int loop, int seq) : game_id(game_id), loop_(loop), seq_(seq) {}
|
||||
bool load_mml(const std::vector<uint8_t>& data);
|
||||
void load_mda(const std::vector<uint8_t>& data);
|
||||
void start_midi();
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
int seq() const { return seq_; }
|
||||
|
||||
private:
|
||||
uint32_t crc32_a;
|
||||
const GameId& game_id;
|
||||
int loop_;
|
||||
int seq_;
|
||||
|
||||
@@ -320,7 +320,7 @@ bool Playback::play_midi(SDL_atomic_t* current_loop, SDL_atomic_t* current_mark)
|
||||
send_3bytes(0xb0 + play[i].channel, 0x0a, play[i].pan);
|
||||
}
|
||||
else if(d0 == 0xec) {
|
||||
if(!(crc32_a == CRC32_DPS || crc32_a == CRC32_DPS_SG || crc32_a == CRC32_DPS_SG2 || crc32_a == CRC32_DPS_SG3))
|
||||
if (!game_id.is_system1_dps())
|
||||
mute_flag = true;
|
||||
}
|
||||
else if(d0 == 0xf5) {
|
||||
@@ -381,7 +381,7 @@ bool Playback::play_midi(SDL_atomic_t* current_loop, SDL_atomic_t* current_mark)
|
||||
//static
|
||||
std::unique_ptr<Playback> Playback::create(const GameId& game_id, Dri& amus, Dri& mda, int page, int loop, int seq)
|
||||
{
|
||||
auto playback = std::make_unique<Playback>(game_id.crc32_a, loop, seq);
|
||||
auto playback = std::make_unique<Playback>(game_id, loop, seq);
|
||||
|
||||
std::vector<uint8_t> data = amus.load(page);
|
||||
if (data.empty())
|
||||
@@ -392,7 +392,7 @@ std::unique_ptr<Playback> Playback::create(const GameId& game_id, Dri& amus, Dri
|
||||
// Load MDA
|
||||
data = mda.load(page);
|
||||
if (data.empty())
|
||||
data = Dri::load_mda(game_id.crc32_a, game_id.crc32_b, page);
|
||||
data = Dri::load_mda(game_id, page);
|
||||
playback->load_mda(data);
|
||||
|
||||
return playback;
|
||||
|
||||
+4
-4
@@ -321,7 +321,7 @@ void NACT::cmd_set_menu()
|
||||
ags->menu_dest_y += 2;
|
||||
ags->draw_menu = true;
|
||||
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG)
|
||||
if (game_id.is_gakuen())
|
||||
menu_window = 2;
|
||||
|
||||
output_console("\n$%x,", menu_addr[menu_index - 1]);
|
||||
@@ -337,7 +337,7 @@ void NACT::cmd_open_menu()
|
||||
return;
|
||||
}
|
||||
|
||||
if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
if (game_id.is_system1_dps()) {
|
||||
if (!text_refresh) {
|
||||
cmd_a();
|
||||
}
|
||||
@@ -421,7 +421,7 @@ void NACT::cmd_a()
|
||||
// ウィンドウ更新
|
||||
ags->clear_text_window(text_window, true);
|
||||
|
||||
if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
if (game_id.is_system1_dps()) {
|
||||
text_refresh = true;
|
||||
}
|
||||
}
|
||||
@@ -490,7 +490,7 @@ void NACT::message(uint8_t first_byte)
|
||||
|
||||
ags->draw_text(buf, text_wait_enb);
|
||||
|
||||
if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
if (game_id.is_system1_dps()) {
|
||||
if(!ags->draw_menu) {
|
||||
text_refresh = false;
|
||||
}
|
||||
|
||||
+3
-3
@@ -168,9 +168,6 @@ protected:
|
||||
// DPS
|
||||
bool text_refresh;
|
||||
|
||||
// GAKUEN
|
||||
bool enable_graphics = true;
|
||||
|
||||
bool column = true; // 座標モード
|
||||
bool wait_keydown = true; // ウェイト時のキー受付
|
||||
int text_wait_time = 100; // テキスト表示のウェイト
|
||||
@@ -291,6 +288,9 @@ private:
|
||||
int paint_x;
|
||||
int paint_y;
|
||||
int map_page;
|
||||
|
||||
// GAKUEN
|
||||
bool enable_graphics = true;
|
||||
};
|
||||
|
||||
class NACT_Sys2 final : public NACT {
|
||||
|
||||
@@ -224,7 +224,7 @@ void NACT_Sys1::cmd_open_verb()
|
||||
// 表示する動詞のチェック
|
||||
int chk[MAX_VERB], page = 0, cnt = 0;
|
||||
|
||||
if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG)
|
||||
if (game_id.is_gakuen())
|
||||
menu_window = 1;
|
||||
int menu_max = ags->calculate_menu_max(menu_window);
|
||||
|
||||
@@ -431,7 +431,7 @@ void NACT_Sys1::cmd_g()
|
||||
|
||||
if (game_id.crc32_a == CRC32_INTRUDER) {
|
||||
page = (page == 97) ? 96 : (page == 98) ? 97 : page;
|
||||
} else if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG) {
|
||||
} else if (game_id.is_gakuen()) {
|
||||
page = (page == 3) ? 94 : page;
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ void NACT_Sys1::cmd_y()
|
||||
quit(NACT_HALT);
|
||||
break;
|
||||
}
|
||||
} else if (game_id.crc32_a == CRC32_GAKUEN || game_id.crc32_a == CRC32_GAKUEN_ENG) {
|
||||
} else if (game_id.is_gakuen()) {
|
||||
switch (cmd) {
|
||||
case 1:
|
||||
RND = (param == 0 || param == 1) ? 0 : random(param);
|
||||
@@ -688,7 +688,7 @@ void NACT_Sys1::cmd_y()
|
||||
for(int i = 39; i <= 48; i++) {
|
||||
var[i] = 0;
|
||||
}
|
||||
} else if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
} else if (game_id.is_system1_dps()) {
|
||||
for(int i = 0; i <= 20; i++) {
|
||||
var[i] = 0;
|
||||
}
|
||||
@@ -705,7 +705,7 @@ void NACT_Sys1::cmd_y()
|
||||
RND = (param == 0 || param == 1) ? 0 : random(param);
|
||||
break;
|
||||
case 7:
|
||||
if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
if (game_id.is_system1_dps()) {
|
||||
if(param == 1) {
|
||||
ags->box_fill(0, 40, 8, 598, 270, 0);
|
||||
}
|
||||
@@ -749,7 +749,7 @@ void NACT_Sys1::cmd_y()
|
||||
RND = 0;
|
||||
break;
|
||||
case 255:
|
||||
if (game_id.crc32_a == CRC32_DPS || game_id.crc32_a == CRC32_DPS_SG || game_id.crc32_a == CRC32_DPS_SG2 || game_id.crc32_a == CRC32_DPS_SG3) {
|
||||
if (game_id.is_system1_dps()) {
|
||||
quit(0);
|
||||
} else {
|
||||
quit(NACT_HALT);
|
||||
|
||||
@@ -608,8 +608,7 @@ void NACT_Sys3::cmd_u()
|
||||
|
||||
output_console("\nU %d,%d:", page, transparent);
|
||||
|
||||
if (game_id.crc32_a == CRC32_RANCE41 || game_id.crc32_a == CRC32_RANCE41_ENG ||
|
||||
game_id.crc32_a == CRC32_RANCE42 || game_id.crc32_a == CRC32_RANCE42_ENG) {
|
||||
if (game_id.is_rance4x()) {
|
||||
transparent = (transparent == 28) ? 12 : transparent;
|
||||
}
|
||||
ags->load_cg(page, transparent);
|
||||
|
||||
Reference in New Issue
Block a user