Skip to content

Commit 4810fd5

Browse files
all fixed up
1 parent 0bbb7d4 commit 4810fd5

10 files changed

+792
-718
lines changed

Nexus/Animation.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ void LoadPlayerAnimation(const char *filePath, int playerID)
9797
FileRead(&hitbox->bottom[d], 1);
9898
}
9999
}
100-
playerScriptList[playerID].startWalkSpeed = playerScriptList[playerID].animations[5].speed - 20;
101-
playerScriptList[playerID].startRunSpeed = playerScriptList[playerID].animations[6].speed;
102-
playerScriptList[playerID].startJumpSpeed = playerScriptList[playerID].animations[10].speed - 48;
100+
playerScriptList[playerID].startWalkSpeed = playerScriptList[playerID].animations[ANI_WALKING].speed - 20;
101+
playerScriptList[playerID].startRunSpeed = playerScriptList[playerID].animations[ANI_RUNNING].speed;
102+
playerScriptList[playerID].startJumpSpeed = playerScriptList[playerID].animations[ANI_JUMPING].speed - 48;
103103

104104
CloseFile();
105105
}

Nexus/Debug.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void ProcessSystemMenu()
9494
StrCopy(buffer, modList[m].name.c_str());
9595
StrAdd(buffer, ": ");
9696
StrAdd(buffer, modList[m].active ? " Active" : "Inactive");
97+
for (int c = 0; c < StrLength(buffer); ++c) buffer[c] = toupper(buffer[c]);
9798
AddTextMenuEntry(&gameMenu[1], buffer);
9899
}
99100

@@ -298,6 +299,7 @@ void ProcessSystemMenu()
298299
StrCopy(buffer, modList[gameMenu[1].selection1].name.c_str());
299300
StrAdd(buffer, ": ");
300301
StrAdd(buffer, (modList[gameMenu[1].selection1].active ? " Active" : "Inactive"));
302+
for (int c = 0; c < StrLength(buffer); ++c) buffer[c] = toupper(buffer[c]);
301303
EditTextMenuEntry(&gameMenu[1], buffer, gameMenu[1].selection1);
302304
}
303305

@@ -330,16 +332,12 @@ void ProcessSystemMenu()
330332
ReleaseGlobalSfx();
331333
LoadGlobalSfx();
332334

333-
forceUseScripts = false;
334-
for (int m = 0; m < modCount; ++m) {
335-
if (modList[m].useScripts && modList[m].active)
336-
forceUseScripts = true;
337-
}
338335
saveMods();
339336
}
340337

341338
DrawTextMenu(&gameMenu[0], SCREEN_CENTERX - 4, 40);
342339
DrawTextMenu(&gameMenu[1], SCREEN_CENTERX + 100, 64);
340+
break;
343341
}
344342
default: break;
345343
}

Nexus/Player.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ void LoadPlayerFromList(byte characterID, byte playerID)
9191
void ProcessPlayerAnimationChange(Player *player)
9292
{
9393
if (player->animation != player->prevAnimation) {
94-
if (player->animation == 10)
94+
if (player->animation == ANI_JUMPING)
9595
player->YPos += (hitboxList[0].bottom[0] - hitboxList[1].bottom[0]) << 16;
96-
if (player->prevAnimation == 10)
96+
if (player->prevAnimation == ANI_JUMPING)
9797
player->YPos -= (hitboxList[0].bottom[0] - hitboxList[1].bottom[0]) << 16;
9898
player->prevAnimation = player->animation;
9999
player->frame = 0;
@@ -105,10 +105,10 @@ void DrawPlayer(Player *player, SpriteFrame *frame)
105105
{
106106
int rotation = 0;
107107
switch (player->animation) {
108-
case 5:
109-
case 6:
110-
case 8:
111-
case 34:
108+
case ANI_RUNNING:
109+
case ANI_WALKING:
110+
case ANI_PEELOUT:
111+
case ANI_CORKSCREW:
112112
if (player->rotation >= 0x80)
113113
rotation = 0x200 - ((266 - player->rotation) >> 5 << 6);
114114
else
@@ -374,10 +374,10 @@ void DefaultJumpAction(Player *player)
374374
player->XVelocity = (player->speed * cosVal256[player->angle] + player->stats.jumpStrength * sinVal256[player->angle]) >> 8;
375375
player->YVelocity = (player->speed * sinVal256[player->angle] + -player->stats.jumpStrength * cosVal256[player->angle]) >> 8;
376376
player->speed = player->XVelocity;
377-
player->trackScroll = 1;
378-
player->animation = 10;
377+
player->trackScroll = true;
378+
player->animation = ANI_JUMPING;
379379
player->angle = 0;
380-
player->collisionMode = 0;
380+
player->collisionMode = CMODE_FLOOR;
381381
player->timer = 1;
382382
}
383383

@@ -451,17 +451,17 @@ void ProcessPlayerAnimation(Player *player)
451451
int speed = (player->jumpingSpeed * abs(player->speed) / 6 >> 16) + 48;
452452
if (speed > 0xF0)
453453
speed = 0xF0;
454-
script->animations[10].speed = speed;
454+
script->animations[ANI_JUMPING].speed = speed;
455455

456456
switch (player->animation) {
457-
case 5: script->animations[player->animation].speed = ((uint)(player->walkingSpeed * abs(player->speed) / 6) >> 16) + 20; break;
458-
case 6:
457+
case ANI_WALKING: script->animations[player->animation].speed = ((uint)(player->walkingSpeed * abs(player->speed) / 6) >> 16) + 20; break;
458+
case ANI_RUNNING:
459459
speed = player->runningSpeed * abs(player->speed) / 6 >> 16;
460460
if (speed > 0xF0)
461461
speed = 0xF0;
462462
script->animations[player->animation].speed = speed;
463463
break;
464-
case 8:
464+
case ANI_PEELOUT:
465465
speed = player->runningSpeed * abs(player->speed) / 6 >> 16;
466466
if (speed > 0xF0)
467467
speed = 0xF0;
@@ -474,9 +474,9 @@ void ProcessPlayerAnimation(Player *player)
474474
else
475475
player->animationTimer += player->animationSpeed;
476476
if (player->animation != player->prevAnimation) {
477-
if (player->animation == 10)
477+
if (player->animation == ANI_JUMPING)
478478
player->YPos += (hitboxList[0].bottom[0] - hitboxList[1].bottom[0]) << 16;
479-
if (player->prevAnimation == 10)
479+
if (player->prevAnimation == ANI_JUMPING)
480480
player->YPos -= (hitboxList[0].bottom[0] - hitboxList[1].bottom[0]) << 16;
481481
player->prevAnimation = player->animation;
482482
player->frame = 0;

Nexus/Player.hpp

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
33

44
#define PLAYER_COUNT (0x2)
55

6+
enum PlayerAni {
7+
ANI_STOPPED,
8+
ANI_WAITING,
9+
ANI_BORED,
10+
ANI_LOOKINGUP,
11+
ANI_LOOKINGDOWN,
12+
ANI_WALKING,
13+
ANI_RUNNING,
14+
ANI_SKIDDING,
15+
ANI_PEELOUT,
16+
ANI_SPINDASH,
17+
ANI_JUMPING,
18+
ANI_BOUNCING,
19+
ANI_HURT,
20+
ANI_DYING,
21+
ANI_DROWNING,
22+
ANI_LIFEICON,
23+
ANI_FANROTATE,
24+
ANI_BREATHING,
25+
ANI_PUSHING,
26+
ANI_FLAILINGLEFT,
27+
ANI_FLAILINGRIGHT,
28+
ANI_SLIDING,
29+
ANI_FINISHPOSE = 23,
30+
ANI_CORKSCREW = 34,
31+
ANI_HANGING = 43,
32+
};
33+
634
struct PlayerMovementStats
735
{
836
int topSpeed;

Nexus/Reader.cpp

+55-30
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,43 @@ bool LoadFile(const char *filePath, FileInfo *fileInfo)
6464

6565
Engine.usingDataFileStore = Engine.usingBinFile;
6666

67+
#if RETRO_USE_MOD_LOADER
6768
fileInfo->isMod = false;
6869
isModdedFile = false;
70+
#endif
71+
bool addPath = true;
72+
// Fixes any case differences
73+
char pathLower[0x100];
74+
memset(pathLower, 0, sizeof(char) * 0x100);
75+
for (int c = 0; c < strlen(filePathBuf); ++c) {
76+
pathLower[c] = tolower(filePathBuf[c]);
77+
}
78+
6979
for (int m = 0; m < modCount; ++m) {
7080
if (modList[m].active) {
71-
std::map<std::string, std::string>::const_iterator iter = modList[m].fileMap.find(filePathBuf);
81+
std::map<std::string, std::string>::const_iterator iter = modList[m].fileMap.find(pathLower);
7282
if (iter != modList[m].fileMap.cend()) {
7383
StrCopy(filePathBuf, iter->second.c_str());
7484
Engine.forceFolder = true;
7585
Engine.usingBinFile = false;
7686
fileInfo->isMod = true;
7787
isModdedFile = true;
88+
addPath = false;
7889
break;
7990
}
8091
}
8192
}
8293

83-
if (forceUseScripts && !Engine.forceFolder) {
84-
if (std::string(filePathBuf).rfind("Data/Scripts/", 0) == 0 && ends_with(std::string(filePathBuf), "txt")) {
85-
// is a script, since those dont exist normally, load them from "scripts/"
86-
Engine.forceFolder = true;
87-
Engine.usingBinFile = false;
88-
fileInfo->isMod = true;
89-
isModdedFile = true;
90-
std::string fStr = std::string(filePathBuf);
91-
fStr.erase(fStr.begin(), fStr.begin() + 5); // remove "Data/"
92-
StrCopy(filePathBuf, fStr.c_str());
93-
}
94+
#if RETRO_PLATFORM == RETRO_OSX
95+
if (addPath) {
96+
char pathBuf[0x100];
97+
sprintf(pathBuf, "%s/%s", gamePath, filePathBuf);
98+
sprintf(filePathBuf, "%s", pathBuf);
9499
}
100+
#endif
95101

96-
StrCopy(fileInfo->fileName, filePathBuf);
97-
StrCopy(fileName, filePathBuf);
102+
StrCopy(fileInfo->fileName, "");
103+
StrCopy(fileName, "");
98104

99105
if (Engine.usingBinFile && !Engine.forceFolder) {
100106
cFileHandle = fOpen(binFileName, "rb");
@@ -103,6 +109,9 @@ bool LoadFile(const char *filePath, FileInfo *fileInfo)
103109
bufferPosition = 0;
104110
readSize = 0;
105111
readPos = 0;
112+
113+
StrCopy(fileInfo->fileName, filePath);
114+
StrCopy(fileName, filePath);
106115
if (!ParseVirtualFileSystem(fileInfo)) {
107116
fClose(cFileHandle);
108117
cFileHandle = NULL;
@@ -116,11 +125,14 @@ bool LoadFile(const char *filePath, FileInfo *fileInfo)
116125
fileInfo->encrypted = true;
117126
}
118127
else {
128+
StrCopy(fileInfo->fileName, filePathBuf);
129+
StrCopy(fileName, filePathBuf);
119130
cFileHandle = fOpen(fileInfo->fileName, "rb");
120131
if (!cFileHandle) {
121132
printLog("Couldn't load file '%s'", filePathBuf);
122133
return false;
123134
}
135+
124136
virtualFileOffset = 0;
125137
fSeek(cFileHandle, 0, SEEK_END);
126138
fileInfo->fileSize = (int)fTell(cFileHandle);
@@ -411,35 +423,44 @@ bool LoadFile2(const char *filePath, FileInfo *fileInfo)
411423

412424
Engine.usingDataFileStore = Engine.usingBinFile;
413425

426+
#if RETRO_USE_MOD_LOADER
414427
fileInfo->isMod = false;
415428
isModdedFile = false;
429+
#endif
430+
bool addPath = true;
431+
// Fixes ".ani" ".Ani" bug and any other case differences
432+
char pathLower[0x100];
433+
memset(pathLower, 0, sizeof(char) * 0x100);
434+
for (int c = 0; c < strlen(filePathBuf); ++c) {
435+
pathLower[c] = tolower(filePathBuf[c]);
436+
}
437+
438+
#if RETRO_USE_MOD_LOADER
416439
for (int m = 0; m < modCount; ++m) {
417440
if (modList[m].active) {
418-
std::map<std::string, std::string>::const_iterator iter = modList[m].fileMap.find(filePathBuf);
441+
std::map<std::string, std::string>::const_iterator iter = modList[m].fileMap.find(pathLower);
419442
if (iter != modList[m].fileMap.cend()) {
420443
StrCopy(filePathBuf, iter->second.c_str());
421-
Engine.forceFolder = true;
444+
Engine.forceFolder = true;
422445
Engine.usingBinFile = false;
423-
fileInfo->isMod = true;
424-
isModdedFile = true;
446+
fileInfo->isMod = true;
447+
isModdedFile = true;
448+
addPath = false;
425449
break;
426450
}
427451
}
428452
}
429-
if (forceUseScripts && !Engine.forceFolder) {
430-
if (std::string(filePathBuf).rfind("Data/Scripts/", 0) == 0 && ends_with(std::string(filePathBuf), "txt")) {
431-
// is a script, since those dont exist normally, load them from "scripts/"
432-
Engine.forceFolder = true;
433-
Engine.usingBinFile = false;
434-
fileInfo->isMod = true;
435-
isModdedFile = true;
436-
std::string fStr = std::string(filePathBuf);
437-
fStr.erase(fStr.begin(), fStr.begin() + 5); // remove "Data/"
438-
StrCopy(filePathBuf, fStr.c_str());
439-
}
453+
#endif
454+
455+
#if RETRO_PLATFORM == RETRO_OSX
456+
if (addPath) {
457+
char pathBuf[0x100];
458+
sprintf(pathBuf, "%s/%s", gamePath, filePathBuf);
459+
sprintf(filePathBuf, "%s", pathBuf);
440460
}
461+
#endif
441462

442-
StrCopy(fileInfo->fileName, filePathBuf);
463+
StrCopy(fileInfo->fileName, "");
443464

444465
if (Engine.usingBinFile && !Engine.forceFolder) {
445466
fileInfo->cFileHandle = fOpen(binFileName, "rb");
@@ -449,6 +470,8 @@ bool LoadFile2(const char *filePath, FileInfo *fileInfo)
449470
// readSize = 0;
450471
fileInfo->readPos = 0;
451472
fileInfo->encrypted = true;
473+
474+
StrCopy(fileInfo->fileName, filePath);
452475
if (!ParseVirtualFileSystem2(fileInfo)) {
453476
fClose(fileInfo->cFileHandle);
454477
fileInfo->cFileHandle = NULL;
@@ -457,11 +480,13 @@ bool LoadFile2(const char *filePath, FileInfo *fileInfo)
457480
}
458481
}
459482
else {
483+
StrCopy(fileInfo->fileName, filePathBuf);
460484
fileInfo->cFileHandle = fOpen(fileInfo->fileName, "rb");
461485
if (!fileInfo->cFileHandle) {
462486
printLog("Couldn't load file '%s'", filePathBuf);
463487
return false;
464488
}
489+
465490
fSeek(fileInfo->cFileHandle, 0, SEEK_END);
466491
fileInfo->vFileSize = (int)fTell(fileInfo->cFileHandle);
467492
fileInfo->fileSize = fileInfo->vFileSize;

Nexus/Scene.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ void SetPlayerScreenPositionCDStyle(Player *player)
11431143

11441144
if (!player->gravity) {
11451145
if (player->direction) {
1146-
if (player->animation == 8 || player->animation == 9 || player->speed < -0x5F5C2) {
1146+
if (player->animation == ANI_PEELOUT || player->animation == ANI_SPINDASH || player->speed < -0x5F5C2) {
11471147
if (cameraLag < 64)
11481148
cameraLag += 2;
11491149
}
@@ -1153,7 +1153,7 @@ void SetPlayerScreenPositionCDStyle(Player *player)
11531153
cameraLag -= 2;
11541154
}
11551155
}
1156-
else if (player->animation == 8 || player->animation == 9 || player->speed > 0x5F5C2) {
1156+
else if (player->animation == ANI_PEELOUT || player->animation == ANI_SPINDASH || player->speed > 0x5F5C2) {
11571157
if (cameraLag > -64)
11581158
cameraLag -= 2;
11591159
}

0 commit comments

Comments
 (0)