diff --git a/include/parts.h b/include/parts.h
index 08d5ac7..14d050a 100644
--- a/include/parts.h
+++ b/include/parts.h
@@ -29,13 +29,15 @@ void PE_UpdateParts(int passed_time, bool is_skip, bool message_window_show);
bool PE_SetPartsCG(int parts_no, struct string *cg_name, int sprite_deform, int state);
bool PE_SetPartsCG_by_index(int parts_no, int cg_no, int sprite_deform, int state);
int PE_GetPartsCGNumber(int parts_no, int state);
-bool PE_SetLoopCG(int parts_no, int cg_no, int nr_frames, int frame_time, int state);
-bool PE_SetHGaugeCG(int parts_no, int cg_no, int state);
+bool PE_SetLoopCG_by_index(int parts_no, int cg_no, int nr_frames, int frame_time, int state);
+bool PE_SetHGaugeCG(int parts_no, struct string *cg_name, int state);
+bool PE_SetHGaugeCG_by_index(int parts_no, int cg_no, int state);
bool PE_SetHGaugeRate(int parts_no, int numerator, int denominator, int state);
-bool PE_SetVGaugeCG(int parts_no, int cg_no, int state);
+bool PE_SetVGaugeCG(int parts_no, struct string *cg_name, int state);
+bool PE_SetVGaugeCG_by_index(int parts_no, int cg_no, int state);
bool PE_SetVGaugeRate(int parts_no, int numerator, int denominator, int state);
-bool PE_SetNumeralCG(int parts_no, int cg_no, int state);
-bool PE_SetNumeralLinkedCGNumberWidthWidthList(int parts_no, int cg_no, int w0, int w1, int w2, int w3, int w4, int w5, int w6, int w7, int w8, int w9, int w_minus, int w_comma, int state);
+bool PE_SetNumeralCG_by_index(int parts_no, int cg_no, int state);
+bool PE_SetNumeralLinkedCGNumberWidthWidthList_by_index(int parts_no, int cg_no, int w0, int w1, int w2, int w3, int w4, int w5, int w6, int w7, int w8, int w9, int w_minus, int w_comma, int state);
bool PE_SetNumeralNumber(int parts_no, int n, int state);
bool PE_SetNumeralShowComma(int parts_no, bool show_comma, int state);
bool PE_SetNumeralSpace(int parts_no, int space, int state);
@@ -103,7 +105,7 @@ int PE_GetClickPartsNumber(void);
// motion.c
void PE_AddMotionPos(int parts_no, int begin_x, int begin_y, int end_x, int end_y, int begin_t, int end_t);
void PE_AddMotionAlpha(int parts_no, int begin_a, int end_a, int begin_t, int end_t);
-void PE_AddMotionCG(int parts_no, int begin_cg_no, int nr_cg, int begin_t, int end_t);
+void PE_AddMotionCG_by_index(int parts_no, int begin_cg_no, int nr_cg, int begin_t, int end_t);
void PE_AddMotionHGaugeRate(int parts_no, int begin_numerator, int begin_denominator,
int end_numerator, int end_denominator, int begin_t, int end_t);
void PE_AddMotionVGaugeRate(int parts_no, int begin_numerator, int begin_denominator,
diff --git a/include/sprite.h b/include/sprite.h
index a3efe3d..12ba895 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -66,6 +66,7 @@ void sprite_set_cg(struct sact_sprite *sp, struct cg *cg);
void sprite_set_cg_2x(struct sact_sprite *sp, struct cg *cg);
int sprite_set_cg_from_asset(struct sact_sprite *sp, int cg_no);
int sprite_set_cg_2x_from_asset(struct sact_sprite *sp, int cg_no);
+int sprite_set_cg_by_name(struct sact_sprite *sp, const char *name);
int sprite_set_cg_from_file(struct sact_sprite *sp, const char *path);
int sprite_save_cg(struct sact_sprite *sp, const char *path);
void sprite_init(struct sact_sprite *sp, int w, int h, int r, int g, int b, int a);
diff --git a/src/ffi.c b/src/ffi.c
index 95137a9..64b66b8 100644
--- a/src/ffi.c
+++ b/src/ffi.c
@@ -527,6 +527,7 @@ static void link_libraries(void)
void init_libraries(void)
{
+ library_run_all("_PreLink");
link_libraries();
library_run_all("_ModuleInit");
}
@@ -535,3 +536,14 @@ void exit_libraries(void)
{
library_run_all("_ModuleFini");
}
+
+void static_library_replace(struct static_library *lib, const char *name, void *fun)
+{
+ for (int i = 0; lib->functions[i].name; i++) {
+ if (!strcmp(lib->functions[i].name, name)) {
+ lib->functions[i].fun = fun;
+ return;
+ }
+ }
+ ERROR("No library function '%s.%s'", lib->name, name);
+}
diff --git a/src/hacks.c b/src/hacks.c
index 908568a..3352fd0 100644
--- a/src/hacks.c
+++ b/src/hacks.c
@@ -169,6 +169,8 @@ void apply_game_specific_hacks(struct ain *ain)
apply_rance7_hacks(ain);
} else if (!strcmp(game_name, "しゃーまんず・さんくちゅあり 巫女の聖域")) {
id_indexed_afa = true;
+ } else if (!strcmp(game_name, "大帝国")) {
+ id_indexed_afa = true;
}
free(game_name);
}
diff --git a/src/hll/ChipmunkSpriteEngine.c b/src/hll/ChipmunkSpriteEngine.c
index d0f069a..d54d74e 100644
--- a/src/hll/ChipmunkSpriteEngine.c
+++ b/src/hll/ChipmunkSpriteEngine.c
@@ -14,25 +14,59 @@
* along with this program; if not, see .
*/
+#include
+
+#include "system4/cg.h"
#include "system4/string.h"
#include "system4/utfsjis.h"
#include "asset_manager.h"
#include "gfx/font.h"
+#include "vm/page.h"
#include "input.h"
#include "sact.h"
#include "CharSpriteManager.h"
#include "xsystem4.h"
#include "hll.h"
+static void ChipmunkSpriteEngine_PreLink(void);
+
static void ChipmunkSpriteEngine_ModuleFini(void)
{
sact_ModuleFini();
}
-static int ChipmunkSpriteEngine_Init(void *imain_system, int cg_cache_size)
+static int ChipmunkSpriteEngine_Init(void *imain_system)
{
- return sact_Init(imain_system, cg_cache_size);
+ return sact_Init(imain_system, 16);
+}
+
+static int ChipmunkSpriteEngine_SP_SetCG(int sp_no, struct string *cg_name)
+{
+ struct sact_sprite *sp = sact_get_sprite(sp_no);
+ if (!sp) return 0;
+ return sprite_set_cg_by_name(sp, cg_name->text);
+}
+
+static int ChipmunkSpriteEngine_CG_IsExist(struct string *cg_name)
+{
+ return asset_exists_by_name(ASSET_CG, cg_name->text, NULL);
+}
+
+static int ChipmunkSpriteEngine_CG_GetMetrics(struct string *cg_name, struct page **page)
+{
+ union vm_value *cgm = (*page)->values;
+ struct cg_metrics metrics;
+ if (!asset_cg_get_metrics_by_name(cg_name->text, &metrics))
+ return 0;
+ cgm[0].i = metrics.w;
+ cgm[1].i = metrics.h;
+ cgm[2].i = metrics.bpp;
+ cgm[3].i = metrics.has_pixel;
+ cgm[4].i = metrics.has_alpha;
+ cgm[5].i = metrics.pixel_pitch;
+ cgm[6].i = metrics.alpha_pitch;
+ return 1;
}
HLL_WARN_UNIMPLEMENTED(0, int, ChipmunkSpriteEngine, SP_SetBrightness, int sp_no, int brightness);
@@ -72,9 +106,18 @@ static bool ChipmunkSpriteEngine_SP_GetFontWidth(struct string *text, int *width
//static bool ChipmunkSpriteEngine_SP_SetAlphaClipperSpriteNumber(int sp_no, int ac_sp_no);
//static int ChipmunkSpriteEngine_SP_GetAlphaClipperSpriteNumber(int sp_no);
-//static int CG_GetFormat(int cg_no);
+//static int CG_GetFormat_by_index(int cg_no);
+//static int CG_GetFormat(struct string *cg_name);
+
+//static bool ChipmunkSpriteEngine_SP_Suspend(int sp_no);
+//static bool ChipmunkSpriteEngine_SP_Resume(int sp_no);
+//static bool ChipmunkSpriteEngine_SP_IsSuspend(int sp_no);
+//static bool ChipmunkSpriteEngine_Debug_GetVideoMemoryInfo(int *max_size, int *use_size, int *use_max_size);
+//static void ChipmunkSpriteEngine_CombineTexture(void);
+//static void ChipmunkSpriteEngine_ReleaseCombinedTexture(void);
HLL_LIBRARY(ChipmunkSpriteEngine,
+ HLL_EXPORT(_PreLink, ChipmunkSpriteEngine_PreLink),
HLL_EXPORT(_ModuleFini, ChipmunkSpriteEngine_ModuleFini),
HLL_EXPORT(Init, ChipmunkSpriteEngine_Init),
HLL_TODO_EXPORT(Error, SACT2_Error),
@@ -84,7 +127,7 @@ HLL_LIBRARY(ChipmunkSpriteEngine,
HLL_EXPORT(SP_GetUnuseNum, sact_SP_GetUnuseNum),
HLL_EXPORT(SP_Count, sact_SP_Count),
HLL_EXPORT(SP_Enum, sact_SP_Enum),
- HLL_EXPORT(SP_SetCG, sact_SP_SetCG),
+ HLL_EXPORT(SP_SetCG, ChipmunkSpriteEngine_SP_SetCG),
HLL_TODO_EXPORT(SP_SetCutCG, ChipmunkSpriteEngine_SP_SetCutCG),
HLL_EXPORT(SP_SetCGFromFile, sact_SP_SetCGFromFile),
HLL_EXPORT(SP_SaveCG, sact_SP_SaveCG),
@@ -155,8 +198,9 @@ HLL_LIBRARY(ChipmunkSpriteEngine,
HLL_EXPORT(Key_IsDown, sact_Key_IsDown),
HLL_EXPORT(KEY_GetState, key_is_down),
HLL_EXPORT(Timer_Get, vm_time),
- HLL_EXPORT(CG_IsExist, sact_CG_IsExist),
- HLL_EXPORT(CG_GetMetrics, sact_CG_GetMetrics),
+ HLL_EXPORT(CG_IsExist, ChipmunkSpriteEngine_CG_IsExist),
+ HLL_EXPORT(CG_GetMetrics, ChipmunkSpriteEngine_CG_GetMetrics),
+ HLL_TODO_EXPORT(CG_GetFormat, ChipmunkSpriteEngine_CG_GetFormat),
HLL_EXPORT(System_GetDate, get_date),
HLL_EXPORT(System_GetTime, get_time),
HLL_TODO_EXPORT(CG_RotateRGB, SACT2_CG_RotateRGB),
@@ -210,5 +254,48 @@ HLL_LIBRARY(ChipmunkSpriteEngine,
HLL_TODO_EXPORT(Debug_GetCurrentAllocatedMemorySize, StoatSpriteEngine_Debug_GetCurrentAllocatedMemorySize),
HLL_TODO_EXPORT(Debug_GetMaxAllocatedMemorySize, StoatSpriteEngine_Debug_GetMaxAllocatedMemorySize),
HLL_TODO_EXPORT(Debug_GetFillRate, StoatSpriteEngine_Debug_GetFillRate),
- HLL_TODO_EXPORT(MUSIC_ReloadParam, StoatSpriteEngine_MUSIC_ReloadParam));
+ HLL_TODO_EXPORT(MUSIC_ReloadParam, StoatSpriteEngine_MUSIC_ReloadParam),
+ HLL_TODO_EXPORT(SP_Suspend, ChipmunkSpriteEngine_SP_Suspend),
+ HLL_TODO_EXPORT(SP_Resume, ChipmunkSpriteEngine_SP_Resume),
+ HLL_TODO_EXPORT(SP_IsSuspend, ChipmunkSpriteEngine_SP_IsSuspend),
+ HLL_TODO_EXPORT(Debug_GetVideoMemoryInfo, ChipmunkSpriteEngine_Debug_GetVideoMemoryInfo),
+ HLL_TODO_EXPORT(CombineTexture, ChipmunkSpriteEngine_CombineTexture),
+ HLL_TODO_EXPORT(ReleaseCombinedTexture, ChipmunkSpriteEngine_ReleaseCombinedTexture));
+static struct ain_hll_function *get_fun(int libno, const char *name)
+{
+ int fno = ain_get_library_function(ain, libno, name);
+ return fno >= 0 ? &ain->libraries[libno].functions[fno] : NULL;
+}
+
+// Daiteikoku and Shaman's Sanctuary have different interface than later versions
+static void ChipmunkSpriteEngine_PreLink(void)
+{
+ struct ain_hll_function *fun;
+ int libno = ain_get_library(ain, "ChipmunkSpriteEngine");
+ assert(libno >= 0);
+
+ fun = get_fun(libno, "Init");
+ if (fun && fun->nr_arguments == 2) {
+ static_library_replace(&lib_ChipmunkSpriteEngine, "Init", sact_Init);
+ }
+
+ fun = get_fun(libno, "SP_SetCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_ChipmunkSpriteEngine, "SP_SetCG", sact_SP_SetCG);
+ }
+
+ // TODO: SP_SetCutCG
+
+ fun = get_fun(libno, "CG_IsExist");
+ if (fun && fun->arguments[0].type.data == AIN_INT) {
+ static_library_replace(&lib_ChipmunkSpriteEngine, "CG_IsExist", sact_CG_IsExist);
+ }
+
+ fun = get_fun(libno, "CG_GetMetrics");
+ if (fun && fun->arguments[0].type.data == AIN_INT) {
+ static_library_replace(&lib_ChipmunkSpriteEngine, "CG_GetMetrics", sact_CG_GetMetrics);
+ }
+
+ // TODO: CG_GetFormat
+}
diff --git a/src/hll/GoatGUIEngine.c b/src/hll/GoatGUIEngine.c
index 0a69725..e2a3960 100644
--- a/src/hll/GoatGUIEngine.c
+++ b/src/hll/GoatGUIEngine.c
@@ -14,15 +14,23 @@
* along with this program; if not, see .
*/
+#include
+
+#include "system4/ain.h"
+
+#include "asset_manager.h"
#include "parts.h"
#include "hll.h"
+static void GoatGUIEngine_PreLink(void);
+
HLL_LIBRARY(GoatGUIEngine,
+ HLL_EXPORT(_PreLink, GoatGUIEngine_PreLink),
HLL_EXPORT(Init, PE_Init),
HLL_EXPORT(Update, PE_Update),
- HLL_EXPORT(SetPartsCG, PE_SetPartsCG_by_index),
+ HLL_EXPORT(SetPartsCG, PE_SetPartsCG),
HLL_EXPORT(GetPartsCGNumber, PE_GetPartsCGNumber),
- HLL_EXPORT(SetLoopCG, PE_SetLoopCG),
+ HLL_TODO_EXPORT(SetLoopCG, PE_SetLoopCG),
HLL_EXPORT(SetText, PE_SetText),
HLL_EXPORT(AddPartsText, PE_AddPartsText),
HLL_TODO_EXPORT(DeletePartsTopTextLine, PE_DeletePartsTopTextLine),
@@ -39,8 +47,8 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_EXPORT(SetHGaugeRate, PE_SetHGaugeRate),
HLL_EXPORT(SetVGaugeCG, PE_SetVGaugeCG),
HLL_EXPORT(SetVGaugeRate, PE_SetVGaugeRate),
- HLL_EXPORT(SetNumeralCG, PE_SetNumeralCG),
- HLL_EXPORT(SetNumeralLinkedCGNumberWidthWidthList, PE_SetNumeralLinkedCGNumberWidthWidthList),
+ HLL_TODO_EXPORT(SetNumeralCG, PE_SetNumeralCG),
+ HLL_TODO_EXPORT(SetNumeralLinkedCGNumberWidthWidthList, PE_SetNumeralLinkedCGNumberWidthWidthList),
HLL_EXPORT(SetNumeralNumber, PE_SetNumeralNumber),
HLL_EXPORT(SetNumeralShowComma, PE_SetNumeralShowComma),
HLL_EXPORT(SetNumeralSpace, PE_SetNumeralSpace),
@@ -58,12 +66,16 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_EXPORT(SetShow, PE_SetShow),
HLL_EXPORT(SetAlpha, PE_SetAlpha),
HLL_TODO_EXPORT(SetPartsDrawFilter, PE_SetPartsDrawFilter),
+ HLL_TODO_EXPORT(SetAddColor, PE_SetAddColor),
+ HLL_TODO_EXPORT(SetMultiplyColor, PE_SetMultiplyColor),
HLL_EXPORT(SetClickable, PE_SetClickable),
HLL_EXPORT(GetPartsX, PE_GetPartsX),
HLL_EXPORT(GetPartsY, PE_GetPartsY),
HLL_EXPORT(GetPartsZ, PE_GetPartsZ),
HLL_EXPORT(GetPartsShow, PE_GetPartsShow),
HLL_EXPORT(GetPartsAlpha, PE_GetPartsAlpha),
+ HLL_TODO_EXPORT(GetAddColor, PE_GetAddColor),
+ HLL_TODO_EXPORT(GetMultiplyColor, PE_GetMultiplyColor),
HLL_EXPORT(GetPartsClickable, PE_GetPartsClickable),
HLL_EXPORT(SetPartsOriginPosMode, PE_SetPartsOriginPosMode),
HLL_EXPORT(GetPartsOriginPosMode, PE_GetPartsOriginPosMode),
@@ -82,7 +94,7 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_EXPORT(GetClickPartsNumber, PE_GetClickPartsNumber),
HLL_EXPORT(AddMotionPos, PE_AddMotionPos),
HLL_EXPORT(AddMotionAlpha, PE_AddMotionAlpha),
- HLL_EXPORT(AddMotionCG, PE_AddMotionCG),
+ HLL_TODO_EXPORT(AddMotionCG, PE_AddMotionCG),
HLL_EXPORT(AddMotionHGaugeRate, PE_AddMotionHGaugeRate),
HLL_EXPORT(AddMotionVGaugeRate, PE_AddMotionVGaugeRate),
HLL_EXPORT(AddMotionNumeralNumber, PE_AddMotionNumeralNumber),
@@ -92,6 +104,7 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_EXPORT(AddMotionRotateY, PE_AddMotionRotateY),
HLL_EXPORT(AddMotionRotateZ, PE_AddMotionRotateZ),
HLL_EXPORT(AddMotionVibrationSize, PE_AddMotionVibrationSize),
+ HLL_TODO_EXPORT(AddWholeMotionVibrationSize, PE_AddWholeMotionVibrationSize),
HLL_EXPORT(AddMotionSound, PE_AddMotionSound),
HLL_EXPORT(BeginMotion, PE_BeginMotion),
HLL_EXPORT(EndMotion, PE_EndMotion),
@@ -108,4 +121,72 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_TODO_EXPORT(SetThumbnailReductionSize, PE_SetThumbnailReductionSize),
HLL_TODO_EXPORT(SetThumbnailMode, PE_SetThumbnailMode),
HLL_EXPORT(Save, PE_Save),
- HLL_EXPORT(Load, PE_Load));
+ HLL_EXPORT(Load, PE_Load),
+
+ HLL_TODO_EXPORT(SetPartsFlashAndStop, PE_SetPartsFlashAndStop),
+ HLL_TODO_EXPORT(StopPartsFlash, PE_StopPartsFlash),
+ HLL_TODO_EXPORT(StartPartsFlash, PE_StartPartsFlash),
+ HLL_TODO_EXPORT(GoFramePartsFlash, PE_GoFramePartsFlash),
+ HLL_TODO_EXPORT(GetPartsFlashEndFrame, PE_GetPartsFlashEndFrame),
+ HLL_TODO_EXPORT(ClearPartsConstructionProcess, PE_ClearPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddCreateToPartsConstructionProcess, PE_AddCreateToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddCreatePixelOnlyToPartsConstructionProcess, PE_AddCreatePixelOnlyToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddFillToPartsConstructionProcess, PE_AddFillToPartsConstructionProcess),
+ HLL_EXPORT(AddFillAlphaColorToPartsConstructionProcess, PE_AddFillAlphaColorToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddFillAMapToPartsConstructionProcess, PE_AddFillAMapToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddFillWithAlphaToPartsConstructionProcess, PE_AddFillWithAlphaToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddFillGradationHorizonToPartsConstructionProcess, PE_AddFillGradationHorizonToPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddDrawRectToPartsConstructionProcess, PE_AddDrawRectToPartsConstructionProcess),
+ HLL_EXPORT(BuildPartsConstructionProcess, PE_BuildPartsConstructionProcess),
+ HLL_TODO_EXPORT(AddDrawTextToPartsConstructionProcess, PE_AddDrawTextToPartsConstructionProcess));
+
+static struct ain_hll_function *get_fun(int libno, const char *name)
+{
+ int fno = ain_get_library_function(ain, libno, name);
+ return fno >= 0 ? &ain->libraries[libno].functions[fno] : NULL;
+}
+
+// Daiteikoku and Shaman's Sanctuary have different interface than later versions
+static void GoatGUIEngine_PreLink(void)
+{
+ struct ain_hll_function *fun;
+ int libno = ain_get_library(ain, "GoatGUIEngine");
+ assert(libno >= 0);
+
+ fun = get_fun(libno, "SetPartsCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetPartsCG", PE_SetPartsCG_by_index);
+ }
+
+ fun = get_fun(libno, "SetLoopCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetLoopCG", PE_SetLoopCG_by_index);
+ }
+
+ fun = get_fun(libno, "SetHGaugeCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetHGaugeCG", PE_SetHGaugeCG_by_index);
+ }
+
+ fun = get_fun(libno, "SetVGaugeCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetVGaugeCG", PE_SetVGaugeCG_by_index);
+ }
+
+ fun = get_fun(libno, "SetNumeralCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetNumeralCG", PE_SetNumeralCG_by_index);
+ }
+
+ fun = get_fun(libno, "SetNumeralLinkedCGNumberWidthWidthList");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "SetNumeralLinkedCGNumberWidthWidthList",
+ PE_SetNumeralLinkedCGNumberWidthWidthList_by_index);
+ }
+
+ fun = get_fun(libno, "AddMotionCG");
+ if (fun && fun->arguments[1].type.data == AIN_INT) {
+ static_library_replace(&lib_GoatGUIEngine, "AddMotionCG", PE_AddMotionCG_by_index);
+ }
+
+}
diff --git a/src/hll/hll.h b/src/hll/hll.h
index bfde4df..e1fbea2 100644
--- a/src/hll/hll.h
+++ b/src/hll/hll.h
@@ -24,6 +24,8 @@
#include "vm.h"
#include "system4.h"
+void static_library_replace(struct static_library *lib, const char *name, void *fun);
+
#define HLL_WARN_UNIMPLEMENTED(rval, rtype, libname, fname, ...) \
static rtype libname ## _ ## fname(__VA_ARGS__) { \
WARNING("Unimplemented HLL function: " #libname "." #fname); \
diff --git a/src/parts/construction.c b/src/parts/construction.c
index f338e8c..f200854 100644
--- a/src/parts/construction.c
+++ b/src/parts/construction.c
@@ -48,6 +48,10 @@ static bool parts_add_cp_op(int parts_no, struct parts_cp_op *op, int state)
return true;
}
+bool PE_ClearPartsConstructionProcess(int parts_no, int state);
+bool PE_AddCreateToPartsConstructionProcess(int parts_no, int w, int h, int state);
+bool PE_AddCreatePixelOnlyToPartsConstructionProcess(int parts_no, int w, int h, int state);
+
bool PE_AddCreateCGToProcess(int parts_no, struct string *cg_name, int state)
{
if (!asset_exists_by_name(ASSET_CG, cg_name->text, NULL)) {
@@ -62,6 +66,8 @@ bool PE_AddCreateCGToProcess(int parts_no, struct string *cg_name, int state)
return parts_add_cp_op(parts_no, op, state);
}
+bool PE_AddFillToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int r, int g, int b, int state);
+
bool PE_AddFillAlphaColorToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int r, int g, int b, int a, int state)
{
struct parts_cp_op *op = xcalloc(1, sizeof(struct parts_cp_op));
@@ -74,6 +80,11 @@ bool PE_AddFillAlphaColorToPartsConstructionProcess(int parts_no, int x, int y,
return parts_add_cp_op(parts_no, op, state);
}
+bool PE_AddFillAMapToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int a, int state);
+bool PE_AddFillWithAlphaToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int r, int g, int b, int a, int state);
+bool PE_AddFillGradationHorizonToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int top_r, int top_g, int top_b, int bot_r, int bot_g, int bot_b, int state);
+bool PE_AddDrawRectToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int r, int g, int b, int state);
+
static void build_cg(struct parts *parts, struct parts_cp_cg *op, int state)
{
// TODO: should this allow composing CGs?
@@ -105,3 +116,5 @@ bool PE_BuildPartsConstructionProcess(int parts_no, int state)
}
return true;
}
+
+bool PE_AddDrawTextToPartsConstructionProcess(int parts_no, int x, int y, struct string *text, int type, int size, int r, int g, int b, float bold_weight, int edge_r, int edge_g, int edge_b, float edge_weight, int char_space, int line_space, int state);
diff --git a/src/parts/motion.c b/src/parts/motion.c
index 300358e..05f6e9f 100644
--- a/src/parts/motion.c
+++ b/src/parts/motion.c
@@ -253,7 +253,7 @@ void PE_AddMotionAlpha(int parts_no, int begin_a, int end_a, int begin_t, int en
parts_add_motion(parts, motion);
}
-void PE_AddMotionCG(int parts_no, int begin_cg_no, int nr_cg, int begin_t, int end_t)
+void PE_AddMotionCG_by_index(int parts_no, int begin_cg_no, int nr_cg, int begin_t, int end_t)
{
struct parts *parts = parts_get(parts_no);
struct parts_motion *motion = parts_motion_alloc(PARTS_MOTION_CG, begin_t, end_t);
@@ -344,6 +344,8 @@ void PE_AddMotionVibrationSize(int parts_no, int begin_w, int begin_h, int begin
parts_add_motion(parts, motion);
}
+void PE_AddWholeMotionVibrationSize(int begin_width, int begin_height, int begin_time, int end_time);
+
void PE_AddMotionSound(int sound_no, int begin_t)
{
struct sound_motion *m = xcalloc(1, sizeof(struct sound_motion));
diff --git a/src/parts/parts.c b/src/parts/parts.c
index 32812cb..c8cc90a 100644
--- a/src/parts/parts.c
+++ b/src/parts/parts.c
@@ -577,7 +577,7 @@ int PE_GetPartsCGNumber(int parts_no, int state)
return parts_get_cg(parts_get(parts_no), state)->no;
}
-bool PE_SetLoopCG(int parts_no, int cg_no, int nr_frames, int frame_time, int state)
+bool PE_SetLoopCG_by_index(int parts_no, int cg_no, int nr_frames, int frame_time, int state)
{
state--;
if (state < 0 || state > 2) {
@@ -614,21 +614,16 @@ bool PE_SetLoopCG(int parts_no, int cg_no, int nr_frames, int frame_time, int st
return true;
}
-static bool set_gauge_cg(int parts_no, int cg_no, int state, bool vert)
+static bool set_gauge_cg(int parts_no, struct cg *cg, int state, bool vert)
{
state--;
if (state < 0 || state >= PARTS_NR_STATES)
return false;
- struct cg *cg = asset_cg_load(cg_no);
- if (!cg)
- return false;
-
struct parts *parts = parts_get(parts_no);
struct parts_gauge *g = vert ? parts_get_vgauge(parts, state) : parts_get_hgauge(parts, state);
gfx_init_texture_with_cg(&g->cg, cg);
gfx_init_texture_with_cg(&g->texture, cg);
- cg_free(cg);
gfx_init_texture_rgba(&g->texture, g->cg.w, g->cg.h, (SDL_Color){0,0,0,255});
gfx_copy_with_alpha_map(&g->texture, 0, 0, &g->cg, 0, 0, g->cg.w, g->cg.h);
@@ -640,9 +635,24 @@ static bool set_gauge_cg(int parts_no, int cg_no, int state, bool vert)
return true;
}
-bool PE_SetHGaugeCG(int parts_no, int cg_no, int state)
+bool PE_SetHGaugeCG(int parts_no, struct string *cg_name, int state)
{
- return set_gauge_cg(parts_no, cg_no, state, false);
+ struct cg *cg = asset_cg_load_by_name(cg_name->text, NULL);
+ if (!cg)
+ return false;
+ bool r = set_gauge_cg(parts_no, cg, state, false);
+ cg_free(cg);
+ return r;
+}
+
+bool PE_SetHGaugeCG_by_index(int parts_no, int cg_no, int state)
+{
+ struct cg *cg = asset_cg_load(cg_no);
+ if (!cg)
+ return false;
+ bool r = set_gauge_cg(parts_no, cg, state, false);
+ cg_free(cg);
+ return r;
}
bool PE_SetHGaugeRate(int parts_no, int numerator, int denominator, int state)
@@ -655,11 +665,25 @@ bool PE_SetHGaugeRate(int parts_no, int numerator, int denominator, int state)
return true;
}
-bool PE_SetVGaugeCG(int parts_no, int cg_no, int state)
+bool PE_SetVGaugeCG(int parts_no, struct string *cg_name, int state)
{
- return set_gauge_cg(parts_no, cg_no, state, true);
+ struct cg *cg = asset_cg_load_by_name(cg_name->text, NULL);
+ if (!cg)
+ return false;
+ bool r = set_gauge_cg(parts_no, cg, state, true);
+ cg_free(cg);
+ return r;
}
+bool PE_SetVGaugeCG_by_index(int parts_no, int cg_no, int state)
+{
+ struct cg *cg = asset_cg_load(cg_no);
+ if (!cg)
+ return false;
+ bool r = set_gauge_cg(parts_no, cg, state, true);
+ cg_free(cg);
+ return r;
+}
bool PE_SetVGaugeRate(int parts_no, int numerator, int denominator, int state)
{
@@ -671,7 +695,7 @@ bool PE_SetVGaugeRate(int parts_no, int numerator, int denominator, int state)
return true;
}
-bool PE_SetNumeralCG(int parts_no, int cg_no, int state)
+bool PE_SetNumeralCG_by_index(int parts_no, int cg_no, int state)
{
state--;
if (state < 0 || state >= PARTS_NR_STATES)
@@ -687,7 +711,7 @@ bool PE_SetNumeralCG(int parts_no, int cg_no, int state)
return true;
}
-bool PE_SetNumeralLinkedCGNumberWidthWidthList(int parts_no, int cg_no, int w0, int w1, int w2, int w3, int w4, int w5, int w6, int w7, int w8, int w9, int w_minus, int w_comma, int state)
+bool PE_SetNumeralLinkedCGNumberWidthWidthList_by_index(int parts_no, int cg_no, int w0, int w1, int w2, int w3, int w4, int w5, int w6, int w7, int w8, int w9, int w_minus, int w_comma, int state)
{
// TODO? Create a generic numeral-font object that can be shared between parts.
// In the current implementation, each number stores a complete copy of
@@ -810,6 +834,8 @@ void PE_SetAlpha(int parts_no, int alpha)
}
void PE_SetPartsDrawFilter(int PartsNumber, int DrawFilter);
+void PE_SetAddColor(int PartsNumber, int nR, int nG, int nB);
+void PE_SetMultiplyColor(int PartsNumber, int nR, int nG, int nB);
int PE_GetPartsX(int parts_no)
{
@@ -848,6 +874,9 @@ int PE_GetPartsAlpha(int parts_no)
return parts_get(parts_no)->alpha;
}
+void PE_GetAddColor(int PartsNumber, int *nR, int *nG, int *nB);
+void PE_GetMultiplyColor(int PartsNumber, int *nR, int *nG, int *nB);
+
void PE_SetPartsOriginPosMode(int parts_no, int origin_pos_mode)
{
struct parts *parts = parts_get(parts_no);
@@ -940,3 +969,8 @@ bool PE_IsExist(int parts_no)
return !!ht_get_int(parts_table, parts_no, NULL);
}
+bool PE_SetPartsFlashAndStop(int PartsNumber, struct string *pIFlashFileName, int State);
+bool PE_StopPartsFlash(int PartsNumber, int State);
+bool PE_StartPartsFlash(int PartsNumber, int State);
+bool PE_GoFramePartsFlash(int PartsNumber, int FrameNumber, int State);
+int PE_GetPartsFlashEndFrame(int PartsNumber, int State);
diff --git a/src/sprite.c b/src/sprite.c
index 15d4882..887d721 100644
--- a/src/sprite.c
+++ b/src/sprite.c
@@ -137,7 +137,16 @@ int sprite_set_cg_2x_from_asset(struct sact_sprite *sp, int cg_no)
sp->cg_no = cg_no;
cg_free(cg);
return 1;
+}
+int sprite_set_cg_by_name(struct sact_sprite *sp, const char *name)
+{
+ struct cg *cg = asset_cg_load_by_name(name, &sp->cg_no);
+ if (!cg)
+ return 0;
+ sprite_set_cg(sp, cg);
+ cg_free(cg);
+ return 1;
}
int sprite_set_cg_from_file(struct sact_sprite *sp, const char *path)
diff --git a/subprojects/libsys4 b/subprojects/libsys4
index 42a70d0..62b984d 160000
--- a/subprojects/libsys4
+++ b/subprojects/libsys4
@@ -1 +1 @@
-Subproject commit 42a70d0b29736ca29f8284268b8776150619bbac
+Subproject commit 62b984d9aa2b8df4086ae12284f477775a2b9f33