Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Naming] .MPN: Rename mptn_* to mpn_*
We've been using the three-letter extension names for everything else that isn't .DAT, so it's more consistent to do the same for .MPN, however particularly nice and readable its FOURCC may be. 8.3 filenames also really appreciate that they'll have to accommodate one fewer letter. Part of P0138, funded by [Anonymous] and Blue Bolt.
- Loading branch information
Showing
11 changed files
with
123 additions
and
124 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
typedef struct { | ||
char magic[4]; // = "MPTN" | ||
char count; | ||
char unused; | ||
} mpn_header_t; | ||
|
||
#define MPN_SIZE (8 * 16) | ||
|
||
extern unsigned char mpn_count; | ||
extern int *mpn_buffer; | ||
extern Palette8 mpn_palette; | ||
|
||
// Reads the .MPN file with the given [fn] into the newly reallocated | ||
// [mpn_buffer], and sets [mpn_count] and [mpn_palette] accordingly. | ||
int pascal mpn_load(const char *fn); | ||
|
||
// Like mpn_load(), but sets the hardware palette to the one in [fn]'s header. | ||
int pascal mpn_load_palette_show(const char *fn); | ||
|
||
void mpn_free(void); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma option -zCSHARED -3 | ||
|
||
extern "C" { | ||
#include <mem.h> | ||
#include "platform.h" | ||
#include "pc98.h" | ||
#include "master.hpp" | ||
#include "th02/formats/mpn.hpp" | ||
|
||
void mpn_palette_show(void) | ||
{ | ||
palette_set_all(mpn_palette); | ||
palette_show(); | ||
} | ||
|
||
int pascal mpn_load_palette_show(const char *fn) | ||
{ | ||
extern bool mpn_show_palette_on_load; | ||
mpn_header_t header; | ||
|
||
file_ropen(fn); | ||
file_read(&header, sizeof(header)); | ||
mpn_count = header.count; | ||
file_read(&mpn_palette, sizeof(mpn_palette)); | ||
if(mpn_show_palette_on_load) { | ||
mpn_palette_show(); | ||
} | ||
if(mpn_buffer) { | ||
mpn_free(); | ||
} | ||
mpn_buffer = reinterpret_cast<int __seg*>( | ||
hmem_allocbyte((mpn_count + 1) * MPN_SIZE) | ||
); | ||
if(!mpn_buffer) { | ||
file_close(); | ||
return -1; | ||
} | ||
file_read(mpn_buffer, (mpn_count + 1) * MPN_SIZE); | ||
file_close(); | ||
return 0; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "th02/formats/mpn_i.cpp" |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.