Corrected formatting in Map.cpp

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2019-05-08 09:28:44 +02:00
parent 71015da19b
commit 1d0129e681

View file

@ -29,16 +29,16 @@ BOOL LoadMapData2(const char *path_map)
{
unsigned char dum;
//Get path
// Get path
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gDataPath, path_map);
//Open file
// Open file
FILE *fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
//Make sure file begins with "PXM"
// Make sure file begins with "PXM"
char check[3];
fread(check, 1, 3, fp);
@ -50,10 +50,9 @@ BOOL LoadMapData2(const char *path_map)
else
{
fread(&dum, 1, 1, fp);
//Get width and height
// Get width and height
#ifdef NONPORTABLE
// This fails on big-endian hardware, and platforms
// where short is not two bytes long.
// This fails on big-endian hardware, and platforms where short is not two bytes long.
fread(&gMap.width, 2, 1, fp);
fread(&gMap.length, 2, 1, fp);
#else
@ -68,7 +67,7 @@ BOOL LoadMapData2(const char *path_map)
}
else
{
//Read tiledata
// Read tiledata
fread(gMap.data, 1, gMap.length * gMap.width, fp);
fclose(fp);
return TRUE;
@ -80,7 +79,7 @@ BOOL LoadMapData2(const char *path_map)
BOOL LoadAttributeData(const char *path_atrb)
{
//Open file
// Open file
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gDataPath, path_atrb);
@ -88,7 +87,7 @@ BOOL LoadAttributeData(const char *path_atrb)
if (fp == NULL)
return FALSE;
//Read data
// Read data
fread(gMap.atrb, 1, 0x100, fp);
fclose(fp);
return TRUE;
@ -158,7 +157,7 @@ void PutStage_Back(int fx, int fy)
RECT rect;
int num_x;
//Get range to draw
// Get range to draw
num_x = ((WINDOW_WIDTH + 0xF) / 0x10) + 1;
num_y = ((WINDOW_HEIGHT + 0xF) / 0x10) + 1;
put_x = (fx / 0x200 + 8) / 0x10;
@ -168,14 +167,14 @@ void PutStage_Back(int fx, int fy)
{
for (i = put_x; i < put_x + num_x; i++)
{
//Get attribute
// Get attribute
offset = i + j * gMap.width;
atrb = GetAttribute(i, j);
if (atrb >= 0x20)
continue;
//Draw tile
// Draw tile
rect.left = 16 * (gMap.data[offset] % 0x10);
rect.top = 16 * (gMap.data[offset] / 0x10);
rect.right = rect.left + 16;
@ -199,7 +198,7 @@ void PutStage_Front(int fx, int fy)
RECT rect;
int num_x;
//Get range to draw
// Get range to draw
num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
put_x = (fx / 0x200 + 8) / 16;
@ -209,14 +208,14 @@ void PutStage_Front(int fx, int fy)
{
for (i = put_x; i < put_x + num_x; i++)
{
//Get attribute
// Get attribute
offset = i + j * gMap.width;
atrb = GetAttribute(i, j);
if (atrb < 0x40 || atrb >= 0x80)
continue;
//Draw tile
// Draw tile
rect.left = 16 * (gMap.data[offset] % 0x10);
rect.top = 16 * (gMap.data[offset] / 0x10);
rect.right = rect.left + 16;
@ -242,11 +241,11 @@ void PutMapDataVector(int fx, int fy)
RECT rect;
int num_x;
//Animate the wind
// Animate the wind
static unsigned char count = 0;
count += 2;
//Get range to draw
// Get range to draw
num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
put_x = (fx / 0x200 + 8) / 16;
@ -256,7 +255,7 @@ void PutMapDataVector(int fx, int fy)
{
for (i = put_x; i < put_x + num_x; i++)
{
//Get attribute
// Get attribute
offset = i + j * gMap.width;
atrb = GetAttribute(i, j);