@@ -67,28 +67,29 @@ DWORD fieldReplacementFound;
67
67
68
68
69
69
static char * lastFieldName;
70
-
70
+ static int lastFieldnameSubstrPos = - 1 ;
71
71
// / <summary>
72
- // /
72
+ // / Returns final field path with either DDS or PNG extension with either palettted or non-paletted instance/version
73
73
// / </summary>
74
74
// / <returns>char* that points to texture of DDS or PNG</returns>
75
75
char * GetFieldBackgroundReplacementTextureName ()
76
76
{
77
77
// directIO_fopenReroute: DEMASTER_EXP\textures\DEMASTER_EXP\textures\field_bg\bv\bvtr_1\bvtr_1_0_2.png, file not found
78
78
char n[256 ]{ 0 };
79
79
static char n2[256 ]{ 0 };
80
- char localn[256 ]{ 0 };
80
+ static char localn[256 ]{ 0 }; // Maki: static so when assigned to lastFieldName it doesn't get fucked out
81
81
static char localn2[256 ]{ 0 };
82
82
int palette = tex_header[52 ];
83
83
84
-
84
+
85
85
86
86
if (GetFieldBackgroundFilename (n))
87
87
{
88
88
n2[0 ] = ' \0 ' ;
89
89
return n2;
90
90
}
91
91
92
+
92
93
93
94
sprintf (localn2, " %s%u_%u" , n, fieldBackgroundRequestedTPage - 16 , palette);
94
95
@@ -101,11 +102,23 @@ char* GetFieldBackgroundReplacementTextureName()
101
102
102
103
OutputDebug (" %s: %s, %s\n " , __func__, localn, " palette not found" );
103
104
lastFieldName = localn2;
104
- return localn2;
105
+ // return localn2; //Maki: it's easier this way for me to replace whenn using no PNG
105
106
}
106
- lastFieldName = localn2;
107
+ else
108
+ {
109
+ lastFieldName = localn; // Maki : localn2 was here instead of localn - probably debug
107
110
OutputDebug (" %s: %s\n " , __func__, localn);
108
- return localn2;
111
+ }
112
+
113
+
114
+ if (lastFieldnameSubstrPos == -1 )
115
+ lastFieldnameSubstrPos = strlen (DIRECT_IO_EXPORT_DIR) + strlen (" textures\\ " );
116
+ // Maki: below are various after-fixes because we tried to do DDS but this one needs special treatment for GL segment- pretty easy
117
+ lastFieldName[strlen (lastFieldName) - 4 ] = ' \0 ' ; // Maki: This is to throw out the extension- yes, we need to do that so far
118
+ lastFieldName = lastFieldName + lastFieldnameSubstrPos;
119
+
120
+
121
+ return lastFieldName; // Maki: yeah, it's for rework, but returning anyway for assembler inject sake
109
122
}
110
123
111
124
__declspec (naked) void _asm_InjectFieldBackgroundModule()
@@ -162,6 +175,10 @@ void _fbgGl()
162
175
163
176
}
164
177
178
+
179
+
180
+ // Maki: This gets checked at first- so we have actually ready .PNG path here- change it so we use one method, not three times getting path lol
181
+ // this checks if replacement exists for 0_0 for either DDS or PNG and sets fieldReplacementFound
165
182
// / <summary>
166
183
// / Passes the DWORD if either the replacement is found or not directly to the game engine
167
184
// / </summary>
0 commit comments