(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list

This commit is contained in:
tron 2005-10-15 11:06:54 +00:00
parent ab41ccb23c
commit d5042d4ab2
13 changed files with 47 additions and 29 deletions

View File

@ -17,6 +17,7 @@
#include "player.h"
#include "airport.h"
#include "vehicle_gui.h"
#include "table/sprites.h"
static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport);
static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport);
@ -116,7 +117,7 @@ void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod)
DrawSprite(sprite | image_ormod, x, y);
if ((AircraftVehInfo(engine)->subtype & 1) == 0) {
DrawSprite(0xF3D, x, y-5);
DrawSprite(SPR_ROTOR_STOPPED, x, y - 5);
}
}
@ -305,7 +306,7 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
w->z_height = 1;
w->vehstatus = VS_HIDDEN | VS_UNCLICKABLE;
w->subtype = 6;
w->cur_image = 0xF3D;
w->cur_image = SPR_ROTOR_STOPPED;
VehiclePositionChanged(w);
}
@ -672,7 +673,7 @@ static void HelicopterTickHandler(Vehicle *v)
if (v->current_order.type == OT_LOADING || (v->vehstatus & VS_STOPPED)) {
if (u->cur_speed != 0) {
u->cur_speed++;
if (u->cur_speed >= 0x80 && u->cur_image == 0xF40) {
if (u->cur_speed >= 0x80 && u->cur_image == SPR_ROTOR_MOVING_3) {
u->cur_speed = 0;
}
}
@ -688,14 +689,13 @@ static void HelicopterTickHandler(Vehicle *v)
spd = u->cur_speed >> 4;
if (spd == 0) {
img = 0xF3D;
img = SPR_ROTOR_STOPPED;
if (u->cur_image == img)
return;
} else if (tick >= spd) {
u->tick_counter = 0;
img = u->cur_image + 1;
if (img > 0xF40)
img = 0xF3E;
if (img > SPR_ROTOR_MOVING_3) img = SPR_ROTOR_MOVING_1;
} else
return;

View File

@ -69,7 +69,7 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio
ormod = PALETTE_CRASH;
DrawSprite(image | ormod, x+25, y+10);
if (v->subtype == 0)
DrawSprite(0xF3D, x+25, y+5);
DrawSprite(SPR_ROTOR_STOPPED, x + 25, y + 5);
if (v->index == selection) {
DrawFrameRect(x-1, y-1, x+58, y+21, 0xF, FR_BORDERONLY);
}
@ -565,7 +565,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
}
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
DrawWindowViewport(w);
} break;
@ -690,7 +690,7 @@ static void DrawAircraftDepotWindow(Window *w)
SetDParam(0, v->unitnumber);
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y+12);
DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x, y + 12);
if ((x+=74) == 2 + 74 * w->hscroll.cap) {
x = 2;

View File

@ -10,6 +10,7 @@
#include "viewport.h"
#include "command.h"
#include "variables.h"
#include "table/sprites.h"
typedef struct TerraformerHeightMod {
TileIndex tile;
@ -485,13 +486,13 @@ int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
void DrawClearLandTile(const TileInfo *ti, byte set)
{
DrawGroundSprite(0xF54 + _tileh_to_sprite[ti->tileh] + set * 19);
DrawGroundSprite(SPR_FLAT_BARE_LAND + _tileh_to_sprite[ti->tileh] + set * 19);
}
void DrawHillyLandTile(const TileInfo *ti)
{
if (ti->tileh != 0) {
DrawGroundSprite(0xFA0 + _tileh_to_sprite[ti->tileh]);
DrawGroundSprite(SPR_FLAT_ROUGH_LAND + _tileh_to_sprite[ti->tileh]);
} else {
DrawGroundSprite(_landscape_clear_sprites[GB(ti->x ^ ti->y, 4, 3)]);
}
@ -529,7 +530,7 @@ static void DrawTile_Clear(TileInfo *ti)
break;
case 2:
DrawGroundSprite(0xFB7 + _tileh_to_sprite[ti->tileh]);
DrawGroundSprite(SPR_FLAT_ROCKY_LAND_1 + _tileh_to_sprite[ti->tileh]);
break;
case 3:

View File

@ -6,10 +6,11 @@
#include "functions.h"
#include "viewport.h"
#include "command.h"
#include "table/sprites.h"
static void DrawTile_Dummy(TileInfo *ti)
{
DrawGroundSpriteAt(0x3EC, ti->x, ti->y, ti->z);
DrawGroundSpriteAt(SPR_SHADOW_CELL, ti->x, ti->y, ti->z);
}

View File

@ -284,7 +284,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
}
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
DrawWindowViewport(w);
} break;
@ -587,7 +587,7 @@ static void DrawRoadDepotWindow(Window *w)
SetDParam(0, v->unitnumber);
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x + 16, y);
DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 16, y);
if ((x+=56) == 2 + 56 * w->hscroll.cap) {
x = 2;

View File

@ -523,7 +523,7 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
}
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
DrawWindowViewport(w);
} break;
@ -663,7 +663,7 @@ static void DrawShipDepotWindow(Window *w)
SetDParam(0, v->unitnumber);
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y + 9);
DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x, y + 9);
if ((x+=90) == 2 + 90 * w->hscroll.cap) {
x = 2;

View File

@ -1359,7 +1359,7 @@ uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, by
/* This is what gets subscribed of dtss->image in newgrf.c,
* so it's probably kinda "default offset". Try to use it as
* emergency measure. */
return 0x42D;
return SPR_RAIL_PLATFORM_Y_FRONT;
}
int GetCustomStationsCount(StationClass sclass)

View File

@ -119,7 +119,7 @@ enum Sprites {
SPR_HUGEHQ_WEST_BUILD = 2630,
SPR_HUGEHQ_SOUTH = 2631,
SPR_STATUE_GROUND = 1420,
SPR_STATUE_COMPANY = 2623,
SPR_STATUE_COMPANY = 2632,
SPR_BOUGHT_LAND = 4790,
/* sprites for rail and rail stations*/

View File

@ -442,7 +442,7 @@ static void DrawTrainDepotWindow(Window *w)
DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); //Draw the counter
/* Draw the pretty flag */
DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 15, y);
y += 14;
}
@ -984,7 +984,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
}
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
DrawWindowViewport(w);
} break;

View File

@ -1074,7 +1074,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (f) DrawFoundation(ti, f);
// default sloped sprites..
if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
}
// bridge ending.
@ -1089,7 +1089,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (!ice) {
DrawClearLandTile(ti, 3);
} else {
DrawGroundSprite(0x11C6 + _tileh_to_sprite[ti->tileh]);
DrawGroundSprite(SPR_FLAT_SNOWY_TILE + _tileh_to_sprite[ti->tileh]);
}
// draw ramp

View File

@ -117,10 +117,10 @@ static void DrawTile_Unmovable(TileInfo *ti)
if (ti->map5 == 2) {
// statue
DrawGroundSprite(0x58C);
DrawGroundSprite(SPR_STATUE_GROUND);
image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
image += 0x8A48;
image += PALETTE_MODIFIER_COLOR | SPR_STATUE_COMPANY;
if (_display_opt & DO_TRANS_BUILDINGS)
MAKE_TRANSPARENT(image);
AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
@ -130,7 +130,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
DrawClearLandTile(ti, 0);
AddSortableSpriteToDraw(
PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + 0x92B6,
PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + PALETTE_MODIFIER_COLOR + SPR_BOUGHT_LAND,
ti->x+8, ti->y+8,
1, 1,
10,

View File

@ -17,7 +17,21 @@
#include "vehicle_gui.h"
const SpriteID _water_shore_sprites[15] = {
0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
0,
SPR_SHORE_TILEH_1,
SPR_SHORE_TILEH_2,
SPR_SHORE_TILEH_3,
SPR_SHORE_TILEH_4,
0,
SPR_SHORE_TILEH_6,
0,
SPR_SHORE_TILEH_8,
SPR_SHORE_TILEH_9,
0,
0,
SPR_SHORE_TILEH_12,
0,
0
};
@ -411,7 +425,7 @@ static void DrawTile_Water(TileInfo *ti)
{
// draw water tile
if (ti->map5 == 0) {
DrawGroundSprite(0xFDD);
DrawGroundSprite(SPR_FLAT_WATER_TILE);
if (ti->z != 0) DrawCanalWater(ti->tile);
return;
}

View File

@ -11,6 +11,7 @@
#include "viewport.h"
#include "console.h"
#include "variables.h"
#include "table/sprites.h"
// delta between mouse cursor and upper left corner of dragged window
static Point _drag_delta;
@ -1430,7 +1431,8 @@ static void MouseLoop(int click, int mousewheel)
DEBUG(misc, 2) ("cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
if (_thd.place_mode != 0 &&
// query button and place sign button work in pause mode
!(_cursor.sprite == 0x2CF || _cursor.sprite == 0x2D2) &&
_cursor.sprite != SPR_CURSOR_QUERY &&
_cursor.sprite != SPR_CURSOR_SIGN &&
_pause != 0 &&
!_cheats.build_in_pause.value)
return;