diff --git a/src/evt/map_api.c b/src/evt/map_api.c index d7f9d4d49..87cf7255c 100644 --- a/src/evt/map_api.c +++ b/src/evt/map_api.c @@ -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; @@ -401,8 +401,6 @@ 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++); @@ -410,13 +408,13 @@ API_CALLABLE(RotateGroup) { 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; @@ -424,7 +422,7 @@ API_CALLABLE(RotateGroup) { 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; @@ -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;