Skip to content

Commit

Permalink
Refactor fix of #57
Browse files Browse the repository at this point in the history
  • Loading branch information
fba authored and AmProsius committed Mar 21, 2024
1 parent 7ef76e7 commit a1a6d87
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/Ninja/G1CP/Content/Fixes/Gamesave/fix057_CastleWallTexture.d
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
* #57 Misplaced texture near Gravo
*/
func int G1CP_057_CastleWallTexture() {
var int vobPtr; vobPtr = G1CP_FindVobByPosF(-5893.91455, -664.270386, 78.9339142, G1CP_057_CastleWallTextureCheck);
if (vobPtr) {
G1CP_MoveVobToPosF(vobPtr, -5902.01807, -664.270386, 82.8507462);
return TRUE;
};
return FALSE;
};

/*
* Make the positions available to the functions below
*/
const float G1CP_057_CastleWallTexture_OriginalPos[3] = {-5893.91455, -664.270386, 78.9339142};
const float G1CP_057_CastleWallTexture_CorrectedPos[3] = {-5902.01807, -664.270386, 82.8507462};

/*
* Callback function to check the found VOBs: Check if the VOB's visual is a decal
Expand All @@ -19,20 +17,22 @@ func int G1CP_057_CastleWallTextureCheck(var int vobPtr) {
return (MEM_GetClassDef(vob.visual) == zCDecal_classDef);
};

/*
* Apply the fix
*/
func int G1CP_057_CastleWallTexture() {
return G1CP_ChangeVobLocation(G1CP_057_CastleWallTexture_OriginalPos, G1CP_057_CastleWallTexture_CorrectedPos,
G1CP_057_CastleWallTextureCheck);
};

/*
* This function reverts the changes
*/
func int G1CP_057_CastleWallTextureRevert() {
// Only revert if it was applied by the G1CP
if (!G1CP_IsFixApplied(57)) {
return FALSE;
};

// Find the VOB again
var int vobPtr; vobPtr = G1CP_FindVobByPosF(-5902.01807, -664.270386, 82.8507462, G1CP_057_CastleWallTextureCheck);
if (vobPtr) {
G1CP_MoveVobToPosF(vobPtr, -5893.91455, -664.270386, 78.9339142);
return TRUE;
};
return FALSE;
return G1CP_ChangeVobLocation(G1CP_057_CastleWallTexture_CorrectedPos, G1CP_057_CastleWallTexture_OriginalPos,
G1CP_057_CastleWallTextureCheck);
};

0 comments on commit a1a6d87

Please sign in to comment.