Fixes for a couple of warnings

This commit is contained in:
Timmy Weerwag 2015-04-12 23:26:15 +02:00
parent 308337806e
commit 930a9d61dd
17 changed files with 51 additions and 47 deletions

View File

@ -21,7 +21,9 @@
#ifndef _ADDRESSES_H_
#define _ADDRESSES_H_
#ifdef _MSC_VER
#pragma warning(disable : 4731)
#endif
#define RCT2_ADDRESS(address, type) ((type*)(address))
#define RCT2_GLOBAL(address, type) (*((type*)(address)))

View File

@ -357,13 +357,13 @@ static void config_save_property_value(FILE *file, uint8 type, value_union *valu
else fwrite("false", 5, 1, file);
break;
case CONFIG_VALUE_TYPE_UINT8:
fprintf(file, "%d", value->value_uint8);
fprintf(file, "%u", value->value_uint8);
break;
case CONFIG_VALUE_TYPE_UINT16:
fprintf(file, "%d", value->value_uint16);
fprintf(file, "%u", value->value_uint16);
break;
case CONFIG_VALUE_TYPE_UINT32:
fprintf(file, "%d", value->value_uint32);
fprintf(file, "%u", value->value_uint32);
break;
case CONFIG_VALUE_TYPE_SINT8:
fprintf(file, "%d", value->value_sint8);

View File

@ -593,7 +593,7 @@ void gfx_draw_sprite_palette_set(rct_drawpixelinfo *dpi, int image_id, int x, in
ecx >>= 3;//SAR
int eax = ((int)no_pixels)<<8;
ecx = -ecx;//Odd
eax = eax & 0xFF00 + *(source_pointer+1);
eax = (eax & 0xFF00) + *(source_pointer+1);
total_no_pixels -= ecx;
source_pointer += 2;
ebx = (uint32)new_source_pointer - eax;

View File

@ -1044,7 +1044,7 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
uint32 char_offset = al - 0x20 + *current_font_sprite_base;
RCT2_GLOBAL(0x00EDF81C, uint32) = (IMAGE_TYPE_USE_PALETTE << 28);
gfx_draw_sprite_palette_set(dpi, (IMAGE_TYPE_USE_PALETTE << 28) | char_offset + SPR_CHAR_START, max_x, max_y, palette_pointer, NULL);
gfx_draw_sprite_palette_set(dpi, ((IMAGE_TYPE_USE_PALETTE << 28) | char_offset) + SPR_CHAR_START, max_x, max_y, palette_pointer, NULL);
max_x += (RCT2_ADDRESS(RCT2_ADDRESS_FONT_CHAR_WIDTH, uint8)[char_offset] & 0xFF);
continue;
}

View File

@ -475,7 +475,7 @@ void viewport_update_position(rct_window *window)
if (window->viewport_target_sprite != -1){
rct_sprite* sprite = &g_sprite_list[window->viewport_target_sprite];
int height = map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF - 16;
int height = (map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF) - 16;
int underground = sprite->unknown.z < height;
viewport_set_underground_flag(underground, window, viewport);

View File

@ -41,23 +41,23 @@ rct_window* g_window_list = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window);
// converted from uint16 values at 0x009A41EC - 0x009A4230
// these are percentage coordinates of the viewport to center to, if a window is obscuring a location, the next is tried
float window_scroll_locations[][2] = {
0.5f, 0.5f,
0.75f, 0.5f,
0.25f, 0.5f,
0.5f, 0.75f,
0.5f, 0.25f,
0.75f, 0.75f,
0.75f, 0.25f,
0.25f, 0.75f,
0.25f, 0.25f,
0.125f, 0.5f,
0.875f, 0.5f,
0.5f, 0.125f,
0.5f, 0.875f,
0.875f, 0.125f,
0.875f, 0.875f,
0.125f, 0.875f,
0.125f, 0.125f,
{0.5f, 0.5f},
{0.75f, 0.5f},
{0.25f, 0.5f},
{0.5f, 0.75f},
{0.5f, 0.25f},
{0.75f, 0.75f},
{0.75f, 0.25f},
{0.25f, 0.75f},
{0.25f, 0.25f},
{0.125f, 0.5f},
{0.875f, 0.5f},
{0.5f, 0.125f},
{0.5f, 0.875f},
{0.875f, 0.125f},
{0.875f, 0.875f},
{0.125f, 0.875f},
{0.125f, 0.125f},
};
static void window_all_wheel_input();

View File

@ -519,7 +519,7 @@ static int award_is_deserved_most_confusing_layout(int awardType, int activeAwar
continue;
peepsCounted++;
if (peep->thoughts[0].var_2 <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_LOST || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_CANT_FIND)
if ((peep->thoughts[0].var_2 <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_LOST) || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_CANT_FIND)
peepsLost++;
}

View File

@ -31,7 +31,7 @@
const int _researchRate[] = { 0, 160, 250, 400 };
// 0x01358844[500]
extern rct_research_item *gResearchItems = (rct_research_item*)RCT2_RESEARCH_ITEMS;
rct_research_item *gResearchItems = (rct_research_item*)RCT2_RESEARCH_ITEMS;
// 0x00EE787C
uint8 gResearchUncompletedCategories;

View File

@ -1622,10 +1622,10 @@ rct_object_entry *object_get_next(rct_object_entry *entry)
pos += 4;
// Skip
pos += *pos++ * 16;
pos += *pos * 16 + 1;
// Skip theme objects
pos += *pos++ * 16;
pos += *pos * 16 + 1;
// Skip
pos += 4;

View File

@ -293,7 +293,7 @@ int peep_update_action(sint16* x, sint16* y, sint16* xy_distance, rct_peep* peep
return 1;
}
int* edi = RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2];
uint32* edi = RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2];
uint8* _edi = (uint8*)(edi[peep->action_sprite_type * 2 + 1]);
peep->action_frame++;
int ebx = _edi[peep->action_frame + 1];
@ -1513,7 +1513,7 @@ static void peep_update_ride_sub_state_2(rct_peep* peep){
if (ride->status == RIDE_STATUS_OPEN &&
++peep->var_AC != 0 &&
!(GET_VEHICLE(ride->vehicles[peep->current_train]))->var_48 & (1 << 4))
!((GET_VEHICLE(ride->vehicles[peep->current_train]))->var_48 & (1 << 4)))
return;
if (ride->mode != RIDE_MODE_FORWARD_ROTATION &&
@ -3477,8 +3477,8 @@ static void peep_update_using_bin(rct_peep* peep){
uint8 bp = RCT2_ADDRESS(0x97EFCC, uint8)[cur_container];
int x, y;
x = peep->x + scenario_rand() & 7 - 3;
y = peep->y + scenario_rand() & 7 - 3;
x = peep->x + (scenario_rand() & 7) - 3;
y = peep->y + (scenario_rand() & 7) - 3;
RCT2_CALLPROC_X(0x67375D, x, scenario_rand() & 3, y, peep->z, 0, 0, bp);
peep->item_standard_flags &= ~(1 << cur_container);
@ -3508,8 +3508,8 @@ static void peep_update_using_bin(rct_peep* peep){
uint8 bp = RCT2_ADDRESS(0x97EFE8, uint8)[cur_container];
int x, y;
x = peep->x + scenario_rand() & 7 - 3;
y = peep->y + scenario_rand() & 7 - 3;
x = peep->x + (scenario_rand() & 7) - 3;
y = peep->y + (scenario_rand() & 7) - 3;
RCT2_CALLPROC_X(0x67375D, x, scenario_rand() & 3, y, peep->z, 0, 0, bp);
peep->item_extra_flags &= ~(1 << cur_container);

View File

@ -448,10 +448,10 @@ void track_load_list(ride_list_item item)
//RCT2_CALLPROC_X(0x006CED50, 0, 0, 0, *((uint16*)&item), 0, 0, 0);
}
static void read(void *dst, void **src, int length)
static void read(void *dst, char **src, int length)
{
memcpy(dst, *src, length);
*((char**)src) += length;
*src += length;
}
/**
@ -553,13 +553,13 @@ rct_track_td6* load_track_design(const char *path)
// Edit the colours to use the new versions
// Unsure why it is 67
edi = (uint8*)&track_design->vehicle_colours;
for (i = 0; i < 67; i++)
*edi++ = RCT2_ADDRESS(0x0097F0BC, uint8)[*edi];
for (i = 0; i < 67; i++, edi++)
*edi = RCT2_ADDRESS(0x0097F0BC, uint8)[*edi];
// Edit the colours to use the new versions
edi = (uint8*)&track_design->track_spine_colour;
for (i = 0; i < 12; i++)
*edi++ = RCT2_ADDRESS(0x0097F0BC, uint8)[*edi];
for (i = 0; i < 12; i++, edi++)
*edi = RCT2_ADDRESS(0x0097F0BC, uint8)[*edi];
// Highest drop height is 1bit = 3/4 a meter in td6
// Highest drop height is 1bit = 1/3 a meter in td4

View File

@ -229,7 +229,7 @@ void vehicle_sounds_update()
vehicle_sound->id = (uint16)-1;
}
label26:
1;
;
}
//for (rct_vehicle_sound_params* vehicle_sound_params = &RCT2_GLOBAL(0x00F438B4, rct_vehicle_sound_params); ; vehicle_sound_params++) {
@ -534,7 +534,7 @@ void vehicle_sounds_update()
}
}
label114:
1;
;
}
}
}

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <time.h>
#include "addresses.h"
#include "audio/audio.h"
#include "config.h"

View File

@ -606,8 +606,8 @@ static void window_editor_object_selection_paint()
text++;
} while (*(text - 1) != 0);
text += 4;
text += *text++ * 16;
text += *text++ * 16;
text += *text * 16 + 1;
text += *text * 16 + 1;
if (RCT2_GLOBAL(text, uint32) & 0x1000000) {
strcpy(stringBuffer, name);

View File

@ -728,7 +728,7 @@ void window_guest_viewport_init(rct_window* w){
}
if (peep->x == SPRITE_LOCATION_NULL && final_check){
rct_ride* ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]);
int x = ride->overall_view & 0xFF * 32 + 16;
int x = (ride->overall_view & 0xFF) * 32 + 16;
int y = (ride->overall_view >> 8) * 32 + 16;
int height = map_element_height(x, y);
height += 32;

View File

@ -79,7 +79,7 @@ void window_tooltip_reset(int x, int y)
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(1 << 4);
}
extern uint8* gTooltip_text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_TOOLTIP_TEXT_BUFFER, uint8);
uint8* gTooltip_text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_TOOLTIP_TEXT_BUFFER, uint8);
/**
*
* rct2: 0x006EA10D

View File

@ -22,6 +22,7 @@
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include <time.h>
#include "../addresses.h"
#include "../object.h"
#include "map.h"
@ -445,7 +446,7 @@ static void mapgen_blob_fill(int height)
for (int x = left; x <= right; x++)
if (x >= firstLand && x <= lastLand)
landX[x, y] = 1;
landX[x * _heightSize + y] = 1;
}
// Do the same for Y
@ -474,7 +475,7 @@ static void mapgen_blob_fill(int height)
}
for (int y = top; y <= bottom; y++) {
if (y >= firstLand && y <= lastLand && landX[x, y]) {
if (y >= firstLand && y <= lastLand && landX[x * _heightSize + y]) {
// Not only do we know its landlocked to both x and y
// we can change the land too
set_height(x, y, BLOB_HEIGHT);