mirror of https://github.com/OpenTTD/OpenTTD
(svn r10697) -Codechange: give a more sensible names to some of the unkX variables.
parent
02ab86631e
commit
5bd241eb5b
|
@ -607,7 +607,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeDisasterVehicle(u, -6 * TILE_SIZE, v->y_pos, 135, DIR_SW, ST_Big_Ufo_Destroyer);
|
InitializeDisasterVehicle(u, -6 * TILE_SIZE, v->y_pos, 135, DIR_SW, ST_Big_Ufo_Destroyer);
|
||||||
u->u.disaster.unk2 = v->index;
|
u->u.disaster.big_ufo_destroyer_target = v->index;
|
||||||
|
|
||||||
w = ForceAllocateSpecialVehicle();
|
w = ForceAllocateSpecialVehicle();
|
||||||
if (w == NULL) return;
|
if (w == NULL) return;
|
||||||
|
@ -667,7 +667,7 @@ static void DisasterTick_Big_Ufo_Destroyer(Vehicle *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.dest == 0) {
|
if (v->current_order.dest == 0) {
|
||||||
u = GetVehicle(v->u.disaster.unk2);
|
u = GetVehicle(v->u.disaster.big_ufo_destroyer_target);
|
||||||
if (delta(v->x_pos, u->x_pos) > TILE_SIZE) return;
|
if (delta(v->x_pos, u->x_pos) > TILE_SIZE) return;
|
||||||
v->current_order.dest = 1;
|
v->current_order.dest = 1;
|
||||||
|
|
||||||
|
|
|
@ -696,7 +696,7 @@ static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
|
||||||
EV_BUBBLE
|
EV_BUBBLE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (v != NULL) v->u.special.unk2 = dir;
|
if (v != NULL) v->u.special.animation_substate = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TileLoop_Industry(TileIndex tile)
|
static void TileLoop_Industry(TileIndex tile)
|
||||||
|
|
|
@ -1053,8 +1053,8 @@ static const OldChunks vehicle_air_chunk[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const OldChunks vehicle_special_chunk[] = {
|
static const OldChunks vehicle_special_chunk[] = {
|
||||||
OCL_SVAR( OC_UINT16, VehicleSpecial, unk0 ),
|
OCL_SVAR( OC_UINT16, VehicleSpecial, animation_state ),
|
||||||
OCL_SVAR( OC_UINT8, VehicleSpecial, unk2 ),
|
OCL_SVAR( OC_UINT8, VehicleSpecial, animation_substate ),
|
||||||
|
|
||||||
OCL_NULL( 7 ), // Junk
|
OCL_NULL( 7 ), // Junk
|
||||||
|
|
||||||
|
@ -1063,7 +1063,7 @@ static const OldChunks vehicle_special_chunk[] = {
|
||||||
|
|
||||||
static const OldChunks vehicle_disaster_chunk[] = {
|
static const OldChunks vehicle_disaster_chunk[] = {
|
||||||
OCL_SVAR( OC_UINT16, VehicleDisaster, image_override ),
|
OCL_SVAR( OC_UINT16, VehicleDisaster, image_override ),
|
||||||
OCL_SVAR( OC_UINT16, VehicleDisaster, unk2 ),
|
OCL_SVAR( OC_UINT16, VehicleDisaster, big_ufo_destroyer_target ),
|
||||||
|
|
||||||
OCL_NULL( 6 ), ///< Junk
|
OCL_NULL( 6 ), ///< Junk
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ static void HandleBrokenRoadVeh(Vehicle *v)
|
||||||
|
|
||||||
if (!(v->vehstatus & VS_HIDDEN)) {
|
if (!(v->vehstatus & VS_HIDDEN)) {
|
||||||
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
||||||
if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
|
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ static void HandleBrokenShip(Vehicle *v)
|
||||||
|
|
||||||
if (!(v->vehstatus & VS_HIDDEN)) {
|
if (!(v->vehstatus & VS_HIDDEN)) {
|
||||||
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
||||||
if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
|
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3138,7 +3138,7 @@ static void HandleBrokenTrain(Vehicle *v)
|
||||||
|
|
||||||
if (!(v->vehstatus & VS_HIDDEN)) {
|
if (!(v->vehstatus & VS_HIDDEN)) {
|
||||||
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
|
||||||
if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
|
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1113,8 +1113,8 @@ static void BreakdownSmokeTick(Vehicle *v)
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->u.special.unk0--;
|
v->u.special.animation_state--;
|
||||||
if (v->u.special.unk0 == 0) {
|
if (v->u.special.animation_state == 0) {
|
||||||
BeginVehicleMove(v);
|
BeginVehicleMove(v);
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
|
@ -1147,8 +1147,8 @@ static void BulldozerInit(Vehicle *v)
|
||||||
{
|
{
|
||||||
v->cur_image = SPR_BULLDOZER_NE;
|
v->cur_image = SPR_BULLDOZER_NE;
|
||||||
v->progress = 0;
|
v->progress = 0;
|
||||||
v->u.special.unk0 = 0;
|
v->u.special.animation_state = 0;
|
||||||
v->u.special.unk2 = 0;
|
v->u.special.animation_substate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BulldozerMovement {
|
struct BulldozerMovement {
|
||||||
|
@ -1194,7 +1194,7 @@ static void BulldozerTick(Vehicle *v)
|
||||||
{
|
{
|
||||||
v->progress++;
|
v->progress++;
|
||||||
if ((v->progress & 7) == 0) {
|
if ((v->progress & 7) == 0) {
|
||||||
const BulldozerMovement* b = &_bulldozer_movement[v->u.special.unk0];
|
const BulldozerMovement* b = &_bulldozer_movement[v->u.special.animation_state];
|
||||||
|
|
||||||
BeginVehicleMove(v);
|
BeginVehicleMove(v);
|
||||||
|
|
||||||
|
@ -1203,11 +1203,11 @@ static void BulldozerTick(Vehicle *v)
|
||||||
v->x_pos += _inc_by_dir[b->direction].x;
|
v->x_pos += _inc_by_dir[b->direction].x;
|
||||||
v->y_pos += _inc_by_dir[b->direction].y;
|
v->y_pos += _inc_by_dir[b->direction].y;
|
||||||
|
|
||||||
v->u.special.unk2++;
|
v->u.special.animation_substate++;
|
||||||
if (v->u.special.unk2 >= b->duration) {
|
if (v->u.special.animation_substate >= b->duration) {
|
||||||
v->u.special.unk2 = 0;
|
v->u.special.animation_substate = 0;
|
||||||
v->u.special.unk0++;
|
v->u.special.animation_state++;
|
||||||
if (v->u.special.unk0 == lengthof(_bulldozer_movement)) {
|
if (v->u.special.animation_state == lengthof(_bulldozer_movement)) {
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
return;
|
return;
|
||||||
|
@ -1399,7 +1399,7 @@ static void BubbleTick(Vehicle *v)
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (v->u.special.unk2 != 0) {
|
if (v->u.special.animation_substate != 0) {
|
||||||
v->spritenum = GB(InteractiveRandom(), 0, 2) + 1;
|
v->spritenum = GB(InteractiveRandom(), 0, 2) + 1;
|
||||||
} else {
|
} else {
|
||||||
v->spritenum = 6;
|
v->spritenum = 6;
|
||||||
|
@ -3042,8 +3042,8 @@ static const SaveLoad _special_desc[] = {
|
||||||
SLE_VAR(Vehicle, progress, SLE_UINT8),
|
SLE_VAR(Vehicle, progress, SLE_UINT8),
|
||||||
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
|
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
|
||||||
|
|
||||||
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, unk0), SLE_UINT16),
|
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, animation_state), SLE_UINT16),
|
||||||
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, unk2), SLE_UINT8),
|
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, animation_substate), SLE_UINT8),
|
||||||
|
|
||||||
/* reserve extra space in savegame here. (currently 16 bytes) */
|
/* reserve extra space in savegame here. (currently 16 bytes) */
|
||||||
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
||||||
|
@ -3080,8 +3080,8 @@ static const SaveLoad _disaster_desc[] = {
|
||||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, 31, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||||
SLE_VAR(Vehicle, tick_counter, SLE_UINT8),
|
SLE_VAR(Vehicle, tick_counter, SLE_UINT8),
|
||||||
|
|
||||||
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleDisaster, image_override), SLE_UINT16),
|
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleDisaster, image_override), SLE_UINT16),
|
||||||
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleDisaster, unk2), SLE_UINT16),
|
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleDisaster, big_ufo_destroyer_target), SLE_UINT16),
|
||||||
|
|
||||||
/* reserve extra space in savegame here. (currently 16 bytes) */
|
/* reserve extra space in savegame here. (currently 16 bytes) */
|
||||||
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
||||||
|
|
|
@ -202,13 +202,13 @@ struct VehicleRoad {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VehicleSpecial {
|
struct VehicleSpecial {
|
||||||
uint16 unk0;
|
uint16 animation_state;
|
||||||
byte unk2;
|
byte animation_substate;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VehicleDisaster {
|
struct VehicleDisaster {
|
||||||
uint16 image_override;
|
uint16 image_override;
|
||||||
uint16 unk2;
|
VehicleID big_ufo_destroyer_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VehicleShip {
|
struct VehicleShip {
|
||||||
|
|
Loading…
Reference in New Issue