Skip to content

Commit

Permalink
other funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
HailSanta authored and HailSanta committed Mar 2, 2024
1 parent b117360 commit f3e9b9c
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/evt/map_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ API_CALLABLE(TranslateGroup) {

API_CALLABLE(RotateGroup) {
Bytecode* args = script->ptrReadPos;
s32 modelID = evt_get_variable(script, *args);
s32 modelID = evt_get_variable(script, *args++);
s32 index = get_transform_group_index(modelID);
ModelTransformGroup* transformGroup;
Matrix4f mtx;
Expand All @@ -401,30 +401,28 @@ API_CALLABLE(RotateGroup) {
return ApiStatus_DONE2;
}

args++;

a = evt_get_float_variable(script, *args++);
x = evt_get_float_variable(script, *args++);
y = evt_get_float_variable(script, *args++);
z = evt_get_float_variable(script, *args++);

transformGroup = get_transform_group(index);

if (!(transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM)) {
if (transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM) {
guRotateF(mtx, a, x, y, z);
guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
} else {
guRotateF(transformGroup->userTransformMtx, a, x, y, z);
transformGroup->flags |= TRANSFORM_GROUP_FLAG_HAS_TRANSFORM;
transformGroup->flags |= TRANSFORM_GROUP_FLAG_MATRIX_DIRTY;
} else {
guRotateF(mtx, a, x, y, z);
guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
}

return ApiStatus_DONE2;
}

API_CALLABLE(ScaleGroup) {
Bytecode* args = script->ptrReadPos;
s32 modelID = evt_get_variable(script, *args);
s32 modelID = evt_get_variable(script, *args++);
s32 transformIndex = get_transform_group_index(modelID);
ModelTransformGroup* transformGroup;
Matrix4f mtx;
Expand All @@ -435,22 +433,19 @@ API_CALLABLE(ScaleGroup) {
return ApiStatus_DONE2;
}

args++;

x = evt_get_float_variable(script, *args++);
y = evt_get_float_variable(script, *args++);
z = evt_get_float_variable(script, *args++);

transformGroup = get_transform_group(transformIndex);

transformIndex = transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM; // TODO fix weird match
if (!(transformIndex)) {
if (transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM) {
guScaleF(mtx, x, y, z);
guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
} else {
guScaleF(transformGroup->userTransformMtx, x, y, z);
transformGroup->flags |= TRANSFORM_GROUP_FLAG_HAS_TRANSFORM;
transformGroup->flags |= TRANSFORM_GROUP_FLAG_MATRIX_DIRTY;
} else {
guScaleF(mtx, x, y, z);
guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
}

return ApiStatus_DONE2;
Expand Down

0 comments on commit f3e9b9c

Please sign in to comment.