data: fix incorrect Colosseum textures (#733)

Resolves #131
This commit is contained in:
lahm86 2023-02-17 12:32:14 +00:00 committed by GitHub
parent 742695c58a
commit 60ffec9609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 5 deletions

View file

@ -8,6 +8,7 @@
- fixed Scion 1 respawning on load (#707)
- fixed dead water rats looking alive when a room's water is drained (#687, regression from 0.12.0)
- fixed triggered flip effects not working if there are no sound devices (#583)
- fixed the incorrect ceiling textures in Colosseum (#131)
## [2.12.1](https://github.com/rr-/Tomb1Main/compare/2.12...2.12.1) - 2023-01-16
- fixed crash when using enhanced saves in levels with flame emitters (#693)

View file

@ -309,7 +309,7 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo
#### Visuals
- added optional shotgun flash sprites
- added optional rendering of pickups on the ground as 3D meshes
- added braid (currently only works in Lost Valley)
- added Lara's braid to each level
- added support for displaying more than 3 pickup sprites
- added more control over when to show health bar and air bar
- added customizable health bar and air bar
@ -324,6 +324,7 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo
- fixed black screen flashing when navigating the inventory
- fixed detail levels text flashing with any option change
- fixed underwater caustics animating at 2x speed
- fixed incorrect ceiling textures in Colosseum
#### Audio
- added music during the credits
@ -383,8 +384,8 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo
The difficulty here is that these features often require inserting a
completely new animation, a textured mesh or a sound file and pretend
they're always been a part of the original game. So far we haven't found a
good way that'll keep the code maintainable.
they're always been a part of the original game. Work is underway on an
injection framework, and the braid is now supported in each level.
4. **Can I play this on Mac, Linux, Android...?**
@ -410,7 +411,10 @@ Note: this section may be subject to change.
- [ ] ...
- [ ] Test for performance and crash resilience
- [ ] 3.0
- [ ] Work on data injection and other features?
- [ ] Work on data injection and other features
- [x] Add Lara's braid to each level
- [ ] Fix texture/face issues
- [ ] ...
## License

View file

@ -193,6 +193,9 @@
"file": "data/level5.phd",
"type": "normal",
"music": 59,
"injections": [
"data/colosseum_roof.bin"
],
"sequence": [
{"type": "start_game"},
{"type": "loop_game"},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/data/colosseum_roof.bin Normal file

Binary file not shown.

View file

@ -13,11 +13,12 @@
#include <stddef.h>
#define BIN_VERSION 1
#define BIN_VERSION 2
typedef enum INJECTION_TYPE {
INJ_GENERAL = 0,
INJ_BRAID = 1,
INJ_TEXTURE_FIX = 2,
} INJECTION_TYPE;
typedef struct INJECTION {
@ -86,6 +87,8 @@ static void Inject_ApplyFaceEdit(
FACE_EDIT *face_edit, int16_t *data_ptr, int16_t texture);
static void Inject_ApplyMeshEdit(MESH_EDIT *mesh_edit);
static void Inject_MeshEdits(INJECTION *injection);
static void Inject_TextureOverwrites(
INJECTION *injection, LEVEL_INFO *level_info, uint8_t *palette_map);
bool Inject_Init(
int num_injections, char *filenames[], INJECTION_INFO *aggregate)
@ -129,6 +132,7 @@ static bool Inject_LoadFromFile(INJECTION *injection, const char *filename)
switch (injection->type) {
case INJ_GENERAL:
case INJ_TEXTURE_FIX:
injection->relevant = true;
break;
case INJ_BRAID:
@ -196,6 +200,7 @@ bool Inject_AllInjections(LEVEL_INFO *level_info)
Inject_SFXData(injection, level_info);
Inject_MeshEdits(injection);
Inject_TextureOverwrites(injection, level_info, palette_map);
// Realign base indices for the next injection.
INJECTION_INFO inj_info = injection->info;
@ -711,6 +716,39 @@ static int16_t *Inject_GetMeshTexture(FACE_EDIT *face_edit)
return NULL;
}
static void Inject_TextureOverwrites(
INJECTION *injection, LEVEL_INFO *level_info, uint8_t *palette_map)
{
INJECTION_INFO inj_info = injection->info;
MYFILE *fp = injection->fp;
uint16_t target_page, source_width, source_height;
uint8_t target_x, target_y;
for (int i = 0; i < inj_info.texture_overwrite_count; i++) {
File_Read(&target_page, sizeof(uint16_t), 1, fp);
File_Read(&target_x, sizeof(uint8_t), 1, fp);
File_Read(&target_y, sizeof(uint8_t), 1, fp);
File_Read(&source_width, sizeof(uint16_t), 1, fp);
File_Read(&source_height, sizeof(uint16_t), 1, fp);
uint8_t *source_img = Memory_Alloc(source_width * source_height);
File_Read(source_img, source_width * source_height, 1, fp);
// Copy the source image pixels directly into the target page.
uint8_t *page = level_info->texture_page_ptrs + target_page * PAGE_SIZE;
int pal_idx, target_pixel;
for (int y = 0; y < source_height; y++) {
for (int x = 0; x < source_width; x++) {
pal_idx = source_img[y * source_width + x];
target_pixel = (y + target_y) * PAGE_WIDTH + x + target_x;
*(page + target_pixel) = palette_map[pal_idx];
}
}
Memory_FreePointer(&source_img);
}
}
static void Inject_Cleanup(void)
{
for (int i = 0; i < m_NumInjections; i++) {

View file

@ -23,6 +23,7 @@ typedef struct INJECTION_INFO {
int32_t sfx_data_size;
int32_t sample_count;
int32_t mesh_edit_count;
int32_t texture_overwrite_count;
} INJECTION_INFO;
bool Inject_Init(