-
-
Save Maxdamantus/cdfb9d595f3298adff9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/level.cpp b/level.cpp | |
index 19f1a7b..9dcd28a 100755 | |
--- a/level.cpp | |
+++ b/level.cpp | |
@@ -59,7 +59,7 @@ LABEL_11: | |
operator delete(v2); | |
} | |
} | |
- v3 = (level *)operator new(22208u); | |
+ v3 = (level *)operator new(sizeof *v3); | |
v17 = 0; | |
if ( v3 ) | |
v4 = LoadLevel(v3, levFileName); | |
@@ -78,7 +78,7 @@ LABEL_11: | |
sub_42FE10(dword_487048); | |
operator delete(v9); | |
} | |
- v10 = (unkstru *)operator new(0x48u); | |
+ v10 = (unkstru *)operator new(sizeof *v10); | |
v17 = 2; | |
if ( v10 ) | |
v11 = sub_42FAE0(v10, currentLev); | |
@@ -390,7 +390,7 @@ void LoadExternalLevel(level *DstBuf, const char *levelFilename) | |
v9 = lev->polygons; | |
do | |
{ | |
- v10 = (polygon *)operator new(0x10u); | |
+ v10 = (polygon *)operator new(sizeof *v10); | |
v26 = v10; | |
v37 = 0; | |
if ( v10 ) | |
@@ -414,7 +414,7 @@ void LoadExternalLevel(level *DstBuf, const char *levelFilename) | |
v13 = lev->objects; | |
do | |
{ | |
- v14 = (levobj *)operator new(0x40u); | |
+ v14 = (levobj *)operator new(sizeof *v14); | |
v26 = v14; | |
v37 = 1; | |
if ( v14 ) | |
@@ -445,7 +445,7 @@ void LoadExternalLevel(level *DstBuf, const char *levelFilename) | |
v18 = lev->pictures; | |
do | |
{ | |
- v19 = (picture *)operator new(0x48u); | |
+ v19 = (picture *)operator new(sizeof *v19); | |
v26 = v19; | |
v37 = 2; | |
if ( v19 ) | |
@@ -694,7 +694,7 @@ polygon *polygonctor(polygon *_this, FILE *File, signed int levVersion) | |
InternalError("gyurugyuru-ben pontszam < 3 || pontszam > MAXPONT!", 0, 0); | |
v9 = v4->numVertice + 10; | |
v4->allocatedVertexCount = v9; | |
- v10 = (pt *)operator new(16 * v9); | |
+ v10 = (pt *)operator new(sizeof *v10 * v9); | |
v11 = 0; | |
v22 = 0; | |
if ( v10 ) | |
@@ -815,7 +815,7 @@ unkstru *sub_42FAE0(unkstru *ecx0, level *arg0) | |
v2->dword3C = 0; | |
v2->dword40 = 0; | |
v8 = maxVertices; | |
- v9 = (unksub *)operator new(56 * maxVertices); | |
+ v9 = (unksub *)operator new(sizeof *v9 * maxVertices); | |
v28 = v9; | |
v34 = 0; | |
if ( v9 ) | |
@@ -1012,7 +1012,7 @@ void sub_430390(unkstru *ecx0, double radius) | |
InternalError("xdim < 0 || ydim < 0!", 0, 0); | |
if ( v2->xdim > 200 || v2->ydim > 200 ) | |
InternalError("xdim > 200 || ydim > 200!", 0, 0); | |
- v15 = (unksub3 **)operator new(4 * v2->ydim * v2->xdim); | |
+ v15 = (unksub3 **)operator new(sizeof *v15 * v2->ydim * v2->xdim); | |
v2->area = v15; | |
if ( !v15 ) | |
PrintError("memory!", 0, 0); | |
@@ -1273,7 +1273,7 @@ void sub_42FF10(unkstru *_this, int x, int y, unksub *a4) | |
unksub3 *sub_42FE40(unkstru *_this) | |
{ | |
unkstru *v1; // edi@1 | |
- void *v2; // eax@2 | |
+ unksub2 *v2; // eax@2 | |
unksub2 *v3; // esi@5 | |
unksub2 *i; // eax@5 | |
unksub2 *v5; // eax@8 | |
@@ -1282,7 +1282,7 @@ unksub3 *sub_42FE40(unkstru *_this) | |
v1 = _this; | |
if ( !_this->dword3C ) | |
{ | |
- v2 = operator new(4004u); | |
+ v2 = new unksub2; | |
v1->dword3C = (unksub2 *)v2; | |
if ( !v2 ) | |
PrintError("memory!", 0, 0); | |
@@ -1294,7 +1294,7 @@ unksub3 *sub_42FE40(unkstru *_this) | |
v3 = i; | |
if ( v1->dword40 == 500 ) | |
{ | |
- v5 = (unksub2 *)operator new(4004u); | |
+ v5 = new unksub2; | |
v3->next = v5; | |
v3 = v5; | |
if ( !v5 ) | |
@@ -1304,7 +1304,7 @@ unksub3 *sub_42FE40(unkstru *_this) | |
} | |
v6 = v1->dword40 + 1; | |
v1->dword40 = v6; | |
- return (unksub3 *)((char *)v3 + 8 * v6 - 8); | |
+ return (unksub3 *)v3 + v6 - 1; | |
} | |
void sub_42FEE0(unkstru *_this) | |
@@ -1330,15 +1330,15 @@ void invertObjectYCoords(level *_this) | |
if ( _this->objCoordsInverted ) | |
{ | |
_this->objCoordsInverted = 0; | |
- v1 = 304; | |
+ v1 = 0; | |
do | |
{ | |
- v2 = *(levobj **)((char *)¤tLev->levId + v1 * 4); | |
+ v2 = currentLev->objects[v1]; | |
if ( v2 ) | |
v2->location.y = -v2->location.y; | |
++v1; | |
} | |
- while ( v1 < 356 ); | |
+ while ( v1 < 52 ); | |
} | |
} | |
@@ -1350,14 +1350,14 @@ void invertObjectYCoords2(level *_this) | |
if ( !_this->objCoordsInverted ) | |
{ | |
_this->objCoordsInverted = 1; | |
- v1 = 304; | |
+ v1 = 0; | |
do | |
{ | |
- v2 = *(levobj **)((char *)¤tLev->levId + v1 * 4); | |
+ v2 = currentLev->objects[v1]; | |
if ( v2 ) | |
v2->location.y = -v2->location.y; | |
++v1; | |
} | |
- while ( v1 < 356 ); | |
+ while ( v1 < 52 ); | |
} | |
} | |
diff --git a/main.cpp b/main.cpp | |
index 0cf5952..5414565 100755 | |
--- a/main.cpp | |
+++ b/main.cpp | |
@@ -1151,12 +1151,11 @@ int resetStartAndApples(kuskidata *a1) | |
v1 = a1; | |
startFound = 0; | |
- v3 = 1216; | |
+ v3 = 0; | |
numberOfApples = 0; | |
- v20 = 1216; | |
do | |
{ | |
- obj = *(levobj **)((char *)¤tLev->levId + v3); | |
+ obj = currentLev->objects[v3]; | |
if ( obj ) | |
{ | |
rand = random(1000); | |
@@ -1207,13 +1206,11 @@ int resetStartAndApples(kuskidata *a1) | |
HIDWORD(v1->pad3kuski.x) = HIDWORD(v17->x); | |
LODWORD(v1->pad3kuski.y) = LODWORD(v17->y); | |
HIDWORD(v1->pad3kuski.y) = HIDWORD(v17->y); | |
- v3 = v20; | |
} | |
} | |
- v3 += 4; | |
- v20 = v3; | |
+ v3++; | |
} | |
- while ( v3 < 1424 ); | |
+ while ( v3 < 52 ); | |
if ( !startFound ) | |
InternalError("topolsetallaktiv-ban palyan nincs kezdo!", 0, 0); | |
return numberOfApples; | |
@@ -3401,16 +3398,14 @@ void sortObjects() | |
while ( v0 ); | |
if ( numObjects > 0 ) | |
{ | |
- v4 = 304; | |
- v5 = numObjects; | |
+ v4 = numObjects - 1; | |
do | |
{ | |
- if ( !*(int *)((char *)¤tLev->levId + v4 * 4) ) | |
+ if ( !currentLev->objects[v4] ) | |
InternalError("topolkillerekelore-ben hezagos kerek tomb!", 0, 0); | |
- ++v4; | |
- --v5; | |
+ --v4; | |
} | |
- while ( v5 ); | |
+ while ( v4 >= 0 ); | |
} | |
if ( numObjects < 2 ) | |
InternalError("topolkillerekelore-ben szam < 2!", 0, 0); | |
@@ -3428,8 +3423,9 @@ void sortObjects() | |
v15 = v7; | |
do | |
{ | |
- v9 = *(levobj **)((char *)v1 + v8 - 4); | |
- v10 = *(levobj **)((char *)&v1->levId + v8); | |
+ // .objects starts at +1216 | |
+ v9 = *v1->objects; | |
+ v10 = v1->objects[1]; | |
v11 = 10; | |
type1 = v9->objType; | |
type2 = v10->objType; | |
@@ -4259,9 +4255,9 @@ int main(int argc, char **argv) | |
playerA = &stru_4539D8; | |
playerB = &stru_453820; | |
initPhysicsVariables(); | |
- player1rec = (rec *)operator new(0x88); | |
+ player1rec = (rec *)operator new(sizeof *player1rec); | |
recctor(player1rec); | |
- player2rec = (rec *)operator new(0x88); | |
+ player2rec = (rec *)operator new(sizeof *player2rec); | |
recctor(player2rec); | |
initLevel(levFileName); | |
sub_42CF30(player1rec, levFileName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment