Implement GoatGUIEngine.AddDrawRectToPartsConstructionProcess

Used in Rance Quest.
This commit is contained in:
kichikuou
2025-06-14 15:37:35 +09:00
parent 13a00c131d
commit c70e5e028e
8 changed files with 44 additions and 5 deletions
+2
View File
@@ -125,6 +125,8 @@ bool PE_AddFillToPartsConstructionProcess(int parts_no, int x, int y, int w, int
bool PE_AddFillAlphaColorToPartsConstructionProcess(int parts_no, int x, int y, int w, int h,
int r, int g, int b, int a, int state);
bool PE_AddFillAMapToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int a, int state);
bool PE_AddDrawRectToPartsConstructionProcess(int parts_no, int x, int y, int w, int h,
int r, int g, int b, int state);
bool PE_AddDrawCutCGToPartsConstructionProcess(int parts_no, struct string *cg_name,
int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh, int interp_type, int state);
bool PE_AddCopyCutCGToPartsConstructionProcess(int parts_no, struct string *cg_name,
+1 -1
View File
@@ -899,7 +899,7 @@ HLL_LIBRARY(GUIEngine,
HLL_EXPORT(Parts_AddFillAMapToPartsConstructionProcess, PE_AddFillAMapToPartsConstructionProcess),
HLL_TODO_EXPORT(Parts_AddFillWithAlphaToPartsConstructionProcess, GUIEngine_Parts_AddFillWithAlphaToPartsConstructionProcess),
HLL_TODO_EXPORT(Parts_AddFillGradationHorizonToPartsConstructionProcess, GUIEngine_Parts_AddFillGradationHorizonToPartsConstructionProcess),
HLL_TODO_EXPORT(Parts_AddDrawRectToPartsConstructionProcess, GUIEngine_Parts_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(Parts_AddDrawRectToPartsConstructionProcess, PE_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(Parts_AddDrawCutCGToPartsConstructionProcess, PE_AddDrawCutCGToPartsConstructionProcess),
HLL_EXPORT(Parts_AddCopyCutCGToPartsConstructionProcess, PE_AddCopyCutCGToPartsConstructionProcess),
HLL_TODO_EXPORT(Parts_AddGrayFilterToPartsConstructionProcess, GUIEngine_Parts_AddGrayFilterToPartsConstructionProcess),
+1 -1
View File
@@ -191,7 +191,7 @@ HLL_LIBRARY(GoatGUIEngine,
HLL_EXPORT(AddFillAMapToPartsConstructionProcess, PE_AddFillAMapToPartsConstructionProcess),
HLL_TODO_EXPORT(AddFillWithAlphaToPartsConstructionProcess, PE_AddFillWithAlphaToPartsConstructionProcess),
HLL_TODO_EXPORT(AddFillGradationHorizonToPartsConstructionProcess, PE_AddFillGradationHorizonToPartsConstructionProcess),
HLL_TODO_EXPORT(AddDrawRectToPartsConstructionProcess, PE_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(AddDrawRectToPartsConstructionProcess, PE_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(BuildPartsConstructionProcess, PE_BuildPartsConstructionProcess),
HLL_EXPORT(AddDrawTextToPartsConstructionProcess, PE_AddDrawTextToPartsConstructionProcess));
+1 -1
View File
@@ -131,7 +131,7 @@ HLL_LIBRARY(PartsEngine,
HLL_EXPORT(AddFillAMapToPartsConstructionProcess, PE_AddFillAMapToPartsConstructionProcess),
HLL_TODO_EXPORT(AddFillWithAlphaToPartsConstructionProcess, PartsEngine_AddFillWithAlphaToPartsConstructionProcess),
HLL_TODO_EXPORT(AddFillGradationHorizonToPartsConstructionProcess, PartsEngine_AddFillGradationHorizonToPartsConstructionProcess),
HLL_TODO_EXPORT(AddDrawRectToPartsConstructionProcess, PartsEngine_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(AddDrawRectToPartsConstructionProcess, PE_AddDrawRectToPartsConstructionProcess),
HLL_EXPORT(AddDrawCutCGToPartsConstructionProcess, PartsEngine_AddDrawCutCGToPartsConstructionProcess_old),
HLL_EXPORT(AddCopyCutCGToPartsConstructionProcess, PartsEngine_AddCopyCutCGToPartsConstructionProcess_old),
HLL_TODO_EXPORT(AddGrayFilterToPartsConstructionProcess, PartsEngine_AddGrayFilterToPartsConstructionProcess),
+31 -2
View File
@@ -38,6 +38,7 @@ void parts_cp_op_free(struct parts_cp_op *op)
case PARTS_CP_FILL:
case PARTS_CP_FILL_ALPHA_COLOR:
case PARTS_CP_FILL_AMAP:
case PARTS_CP_DRAW_RECT:
case PARTS_CP_DRAW_CUT_CG:
case PARTS_CP_COPY_CUT_CG:
break;
@@ -118,7 +119,6 @@ bool PE_AddFillToPartsConstructionProcess(int parts_no, int x, int y, int w, int
parts_add_cp_op(cproc, op);
return true;
}
bool PE_AddFillAlphaColorToPartsConstructionProcess(int parts_no, int x, int y, int w, int h, int r, int g, int b, int a, int state)
@@ -159,8 +159,24 @@ bool PE_AddFillWithAlphaToPartsConstructionProcess(int parts_no, int x, int y, i
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);
int r, int g, int b, int state)
{
if (!parts_state_valid(--state))
return false;
struct parts_construction_process *cproc = get_cproc(parts_no, state);
struct parts_cp_op *op = xcalloc(1, sizeof(struct parts_cp_op));
op->type = PARTS_CP_DRAW_RECT;
op->fill = (struct parts_cp_fill) {
.x = x, .y = y, .w = w, .h = h,
.r = r, .g = g, .b = b, .a = 255
};
parts_add_cp_op(cproc, op);
return true;
}
bool PE_AddDrawCutCGToPartsConstructionProcess(int parts_no, struct string *cg_name,
int dx, int dy, int dw, int dh, int sx, int sy, int sw, int sh, int interp_type, int state)
@@ -322,6 +338,16 @@ static void build_fill_amap(struct parts_construction_process *cproc, struct par
gfx_fill_amap(&cproc->common.texture, op->x, op->y, op->w, op->h, op->a);
}
static void build_draw_rect(struct parts_construction_process *cproc, struct parts_cp_fill *op)
{
int x2 = op->x + op->w - 1;
int y2 = op->y + op->h - 1;
gfx_draw_line(&cproc->common.texture, op->x, op->y, x2, op->y, op->r, op->g, op->b);
gfx_draw_line(&cproc->common.texture, op->x, op->y, op->x, y2, op->r, op->g, op->b);
gfx_draw_line(&cproc->common.texture, x2, op->y, x2, y2, op->r, op->g, op->b);
gfx_draw_line(&cproc->common.texture, op->x, y2, x2, y2, op->r, op->g, op->b);
}
static void build_draw_cut_cg(struct parts_construction_process *cproc, struct parts_cp_cut_cg *op)
{
struct cg *cg = asset_cg_load(op->cg_no);
@@ -388,6 +414,9 @@ bool parts_build_construction_process(struct parts *parts,
case PARTS_CP_FILL_AMAP:
build_fill_amap(cproc, &op->fill);
break;
case PARTS_CP_DRAW_RECT:
build_draw_rect(cproc, &op->fill);
break;
case PARTS_CP_DRAW_CUT_CG:
build_draw_cut_cg(cproc, &op->cut_cg);
break;
+5
View File
@@ -110,6 +110,7 @@ static void parts_construction_process_to_json(struct parts_construction_process
[PARTS_CP_FILL] = "fill",
[PARTS_CP_FILL_ALPHA_COLOR] = "fill_alpha_color",
[PARTS_CP_FILL_AMAP] = "fill_amap",
[PARTS_CP_DRAW_RECT] = "draw_rect",
[PARTS_CP_DRAW_CUT_CG] = "draw_cut_cg",
[PARTS_CP_COPY_CUT_CG] = "copy_cut_cg",
[PARTS_CP_DRAW_TEXT] = "draw_text",
@@ -142,6 +143,7 @@ static void parts_construction_process_to_json(struct parts_construction_process
case PARTS_CP_FILL:
case PARTS_CP_FILL_ALPHA_COLOR:
case PARTS_CP_FILL_AMAP:
case PARTS_CP_DRAW_RECT:
cJSON_AddItemToObjectCS(obj, "rect", tmp = cJSON_CreateObject());
cJSON_AddNumberToObject(tmp, "x", op->fill.x);
cJSON_AddNumberToObject(tmp, "y", op->fill.y);
@@ -487,6 +489,9 @@ static void parts_list_print(struct parts *parts, int indent)
case PARTS_CP_FILL_AMAP:
sys_message(" fill-amap");
break;
case PARTS_CP_DRAW_RECT:
sys_message(" draw-rect");
break;
case PARTS_CP_DRAW_CUT_CG:
sys_message(" draw-cut-cg");
break;
+1
View File
@@ -178,6 +178,7 @@ enum parts_cp_op_type {
PARTS_CP_FILL,
PARTS_CP_FILL_ALPHA_COLOR,
PARTS_CP_FILL_AMAP,
PARTS_CP_DRAW_RECT,
PARTS_CP_DRAW_CUT_CG,
PARTS_CP_COPY_CUT_CG,
PARTS_CP_DRAW_TEXT,
+2
View File
@@ -191,6 +191,7 @@ static void save_parts_cp_op(struct iarray_writer *w, struct parts_cp_op *op)
case PARTS_CP_FILL:
case PARTS_CP_FILL_ALPHA_COLOR:
case PARTS_CP_FILL_AMAP:
case PARTS_CP_DRAW_RECT:
iarray_write(w, op->fill.x);
iarray_write(w, op->fill.y);
iarray_write(w, op->fill.w);
@@ -240,6 +241,7 @@ static struct parts_cp_op *load_parts_cp_op(struct iarray_reader *r)
case PARTS_CP_FILL:
case PARTS_CP_FILL_ALPHA_COLOR:
case PARTS_CP_FILL_AMAP:
case PARTS_CP_DRAW_RECT:
op->fill.x = iarray_read(r);
op->fill.y = iarray_read(r);
op->fill.w = iarray_read(r);