mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
This commit is contained in:
parent
ec31ae9f16
commit
0c25a4b10c
BIN
data/trkfoundw.grf
Normal file
BIN
data/trkfoundw.grf
Normal file
Binary file not shown.
18
landscape.c
18
landscape.c
@ -241,19 +241,33 @@ uint GetSlopeZ(int x, int y)
|
|||||||
return _tile_type_procs[ti.type]->get_slope_z_proc(&ti);
|
return _tile_type_procs[ti.type]->get_slope_z_proc(&ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: add check if this tile has a foundation or not. Since this can't be done easily with the
|
||||||
|
current landscape arrays, we might have to add a new TileTypeProc. */
|
||||||
|
bool hasFoundation(uint tile)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DrawFoundation(TileInfo *ti, uint f)
|
void DrawFoundation(TileInfo *ti, uint f)
|
||||||
{
|
{
|
||||||
|
uint32 sprite_base = SPR_SLOPES_BASE-14;
|
||||||
|
if(hasFoundation( TILE_FROM_XY(ti->x, ti->y-1) )) sprite_base += 22; // foundation in NW direction
|
||||||
|
if(hasFoundation( TILE_FROM_XY(ti->x-1, ti->y) )) sprite_base += 22*2; // foundation in NE direction
|
||||||
|
|
||||||
if (f < 15) {
|
if (f < 15) {
|
||||||
// leveled foundation
|
// leveled foundation
|
||||||
AddSortableSpriteToDraw(f + 0x3DE - 1, ti->x, ti->y, 16, 16, 7, ti->z);
|
if( sprite_base < SPR_SLOPES_BASE ) sprite_base = 990; // use original slope sprites
|
||||||
|
|
||||||
|
AddSortableSpriteToDraw(f-1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z);
|
||||||
ti->z += 8;
|
ti->z += 8;
|
||||||
ti->tileh = 0;
|
ti->tileh = 0;
|
||||||
OffsetGroundSprite(31, 1);
|
OffsetGroundSprite(31, 1);
|
||||||
} else {
|
} else {
|
||||||
// inclined foundation
|
// inclined foundation
|
||||||
|
sprite_base += 14;
|
||||||
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? (SPR_OPENTTD_BASE+17) + (f - 15) : ti->tileh + 0x3DE - 1,
|
HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : ti->tileh + 0x3DE - 1,
|
||||||
ti->x, ti->y, 1, 1, 1, ti->z
|
ti->x, ti->y, 1, 1, 1, ti->z
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -211,9 +211,8 @@ The OpenTTD team:
|
|||||||
Viktor Strigeus (wiggo) - Web hosting services
|
Viktor Strigeus (wiggo) - Web hosting services
|
||||||
|
|
||||||
Thanks to:
|
Thanks to:
|
||||||
Bug Reporters - Thanks for all bug reports.
|
|
||||||
Josef Drexler - For his great work on TTDPatch.
|
Josef Drexler - For his great work on TTDPatch.
|
||||||
Marcin Grzegorczyk - For his TTDPatch work and documentation of TTD internals and graphics.
|
Marcin Grzegorczyk - For his TTDPatch work and documentation of TTD internals and graphics (signals and track foundations).
|
||||||
Mike Ragsdale - OpenTTD installer
|
Mike Ragsdale - OpenTTD installer
|
||||||
pasky - Many patches, newgrf support, etc.
|
pasky - Many patches, newgrf support, etc.
|
||||||
truesatan - Some patches
|
truesatan - Some patches
|
||||||
@ -221,5 +220,6 @@ Thanks to:
|
|||||||
Michael Polnick - Some patches
|
Michael Polnick - Some patches
|
||||||
Michael Blunck - Nice graphics
|
Michael Blunck - Nice graphics
|
||||||
George - Canal graphics
|
George - Canal graphics
|
||||||
|
Bug Reporters - Thanks for all bug reports.
|
||||||
Chris Sawyer - For an amazing game.
|
Chris Sawyer - For an amazing game.
|
||||||
|
|
||||||
|
@ -71,6 +71,13 @@ static const uint16 * const _landscape_spriteindexes[] = {
|
|||||||
_landscape_spriteindexes_3,
|
_landscape_spriteindexes_3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint16 * const _slopes_spriteindexes[] = {
|
||||||
|
_slopes_spriteindexes_0,
|
||||||
|
_slopes_spriteindexes_1,
|
||||||
|
_slopes_spriteindexes_2,
|
||||||
|
_slopes_spriteindexes_3,
|
||||||
|
};
|
||||||
|
|
||||||
static void CompactSpriteCache();
|
static void CompactSpriteCache();
|
||||||
|
|
||||||
void DecodeSpecialSprite(const char *filename, int num, int load_index);
|
void DecodeSpecialSprite(const char *filename, int num, int load_index);
|
||||||
@ -210,6 +217,19 @@ static bool LoadNextSprite(int load_index, byte file_index)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SkipSprites(int count)
|
||||||
|
{
|
||||||
|
while(count>0)
|
||||||
|
{
|
||||||
|
uint16 size;
|
||||||
|
if ( (size = FioReadWord()) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ReadSpriteHeaderSkipData(size, NUM_SPRITES-1);
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Checks, if trg1r.grf is the Windows version
|
// Checks, if trg1r.grf is the Windows version
|
||||||
static bool CheckGrfFile()
|
static bool CheckGrfFile()
|
||||||
{
|
{
|
||||||
@ -246,16 +266,20 @@ static int LoadGrfFile(const char *filename, int load_index, int file_index)
|
|||||||
|
|
||||||
static void LoadGrfIndexed(const char *filename, const uint16 *index_tbl, int file_index)
|
static void LoadGrfIndexed(const char *filename, const uint16 *index_tbl, int file_index)
|
||||||
{
|
{
|
||||||
int start, end;
|
int start;
|
||||||
|
|
||||||
FioOpenFile(file_index, filename);
|
FioOpenFile(file_index, filename);
|
||||||
|
|
||||||
for(;(start=*index_tbl++) != 0xffff;) {
|
for(;(start=*index_tbl++) != 0xffff;) {
|
||||||
end = *index_tbl++;
|
int end = *index_tbl++;
|
||||||
do {
|
if(start==0xfffe) { // skip sprites (amount in second var)
|
||||||
bool b = LoadNextSprite(start, file_index);
|
SkipSprites(end);
|
||||||
assert(b);
|
} else { // load sprites and use indexes from start to end
|
||||||
} while (++start <= end);
|
do {
|
||||||
|
bool b = LoadNextSprite(start, file_index);
|
||||||
|
assert(b);
|
||||||
|
} while (++start <= end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,6 +693,8 @@ static void LoadSpriteTables()
|
|||||||
if ((l=_sprite_page_to_load) != 0)
|
if ((l=_sprite_page_to_load) != 0)
|
||||||
LoadGrfIndexed(_landscape_filenames[l-1], _landscape_spriteindexes[l-1], i++);
|
LoadGrfIndexed(_landscape_filenames[l-1], _landscape_spriteindexes[l-1], i++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++);
|
||||||
|
|
||||||
load_index = SPR_CANALS_BASE;
|
load_index = SPR_CANALS_BASE;
|
||||||
load_index += LoadGrfFile("canalsw.grf", load_index, i++);
|
load_index += LoadGrfFile("canalsw.grf", load_index, i++);
|
||||||
|
@ -132,3 +132,31 @@ static const SpriteID _landscape_spriteindexes_3[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Slope graphics indexes temperate climate */
|
||||||
|
static const SpriteID _slopes_spriteindexes_0[] = {
|
||||||
|
0xfffe, 3,
|
||||||
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
||||||
|
0xffff,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Slope graphics indexes arctic climate */
|
||||||
|
static const SpriteID _slopes_spriteindexes_1[] = {
|
||||||
|
0xfffe, 79,
|
||||||
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
||||||
|
0xffff,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Slope graphics indexes tropical climate */
|
||||||
|
static const SpriteID _slopes_spriteindexes_2[] = {
|
||||||
|
0xfffe, 155,
|
||||||
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
||||||
|
0xffff,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Slope graphics indexes toyland climate */
|
||||||
|
static const SpriteID _slopes_spriteindexes_3[] = {
|
||||||
|
0xfffe, 231,
|
||||||
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
||||||
|
0xffff,
|
||||||
|
};
|
||||||
|
|
||||||
|
5
ttd.h
5
ttd.h
@ -468,8 +468,9 @@ enum SpecialStrings {
|
|||||||
typedef void PlaceProc(uint tile);
|
typedef void PlaceProc(uint tile);
|
||||||
|
|
||||||
enum Sprites {
|
enum Sprites {
|
||||||
SPR_OPENTTD_BASE = 0x1406,
|
SPR_CANALS_BASE = 0x1406,
|
||||||
SPR_CANALS_BASE = SPR_OPENTTD_BASE + 80,
|
SPR_SLOPES_BASE = SPR_CANALS_BASE + 70,
|
||||||
|
SPR_OPENTTD_BASE = SPR_SLOPES_BASE + 74,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MAP_OWNERS {
|
enum MAP_OWNERS {
|
||||||
|
Loading…
Reference in New Issue
Block a user