diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index b26c79ad60..1b912d26aa 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -546,4 +546,9 @@ void redraw_peep_and_rain() } } RCT2_GLOBAL(RCT2_ADDRESS_NO_RAIN_PIXELS, uint32) = 0; -} \ No newline at end of file +} + +void sub_681DE2(rct_drawpixelinfo *dpi, int x, int y, int image1, int image2) +{ + RCT2_CALLPROC_X(0x00681DE2, 0, image1, x, y, 0, (int)dpi, image2); +} diff --git a/src/drawing/drawing.h b/src/drawing/drawing.h index 65ccb9267e..6ca1340859 100644 --- a/src/drawing/drawing.h +++ b/src/drawing/drawing.h @@ -137,4 +137,7 @@ void sub_6C1F57(rct_drawpixelinfo *dpi, int x, int y, int width, int colour, rct void update_rain_animation(); void redraw_peep_and_rain(); +// unknown +void sub_681DE2(rct_drawpixelinfo *dpi, int x, int y, int image1, int image2); + #endif diff --git a/src/interface/viewport.c b/src/interface/viewport.c index da47e8b24d..ae8fc30c5b 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -267,7 +267,10 @@ void sub_689174(sint16* x, sint16* y, sint16 *z) *z = height; } -//void sub_6E7FF3(rct_window* w, rct_viewport* viewport, int x, int y){ +void sub_6E7FF3(rct_window *w, rct_viewport *viewport, int x, int y) +{ + RCT2_CALLPROC_X(0x006E7FF3, 0, 0, 0, x, (int)viewport, (int)w, y); + // int zoom = 1 << viewport->zoom; // if (w >= RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*)){ // if (viewport != w->viewport){ @@ -298,7 +301,7 @@ void sub_689174(sint16* x, sint16* y, sint16 *z) // } // 0x6e824a // }//x6e8255 // -//} +} void sub_6E7F34(rct_window* w, rct_viewport* viewport, sint16 x_diff, sint16 y_diff){ rct_window* orignal_w = w; @@ -332,7 +335,7 @@ void sub_6E7F34(rct_window* w, rct_viewport* viewport, sint16 x_diff, sint16 y_d } w = orignal_w; - RCT2_CALLPROC_X(0x6E7FF3, 0, 0, 0, x_diff, (int)viewport, (int)w, y_diff); + sub_6E7FF3(w, viewport, x_diff, y_diff); } void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){ @@ -641,12 +644,11 @@ void paint_attached_ps(paint_struct* ps, paint_struct* attached_ps, rct_drawpixe } } - if (!(attached_ps->var_0C & 1)){ + if (attached_ps->var_0C & 1) { + sub_681DE2(dpi, x, y, image_id, attached_ps->var_04); + } else { gfx_draw_sprite(dpi, image_id, x, y, ps->var_04); } - else{ - RCT2_CALLPROC_X(0x00681DE2, 0, image_id, x, y, 0, (int)dpi, attached_ps->var_04); - } } } @@ -694,11 +696,11 @@ void sub_688485(){ } } - if (!(ps->var_1A & 1)) - gfx_draw_sprite(dpi, image_id, x, y, ps->var_04); + if (ps->var_1A & 1) + sub_681DE2(dpi, x, y, image_id, ps->var_04); else - RCT2_CALLPROC_X(0x00681DE2, 0, image_id, x, y, 0, (int)dpi, ps->var_04); - + gfx_draw_sprite(dpi, image_id, x, y, ps->var_04); + if (ps->var_20 != 0){ ps = ps->var_20; continue; @@ -862,29 +864,57 @@ int sub_98197C(sint8 al, sint8 ah, int image_id, sint8 cl, int edx, sint16 si, s return 0; } +/** + * + * rct2: 0x006D4244 + */ +void viewport_vehicle_paint_setup(rct_vehicle *vehicle, int imageDirection) +{ + RCT2_CALLPROC_X(0x006D4244, vehicle->x, imageDirection, vehicle->y, vehicle->z, (int)vehicle, 0, 0); +} + +/** + * + * rct2: 0x0068F0FB + */ +void viewport_peep_paint_setup(rct_peep *peep, int imageDirection) +{ + RCT2_CALLPROC_X(0x0068F0FB, peep->x, imageDirection, peep->y, peep->z, (int)peep, 0, 0); +} + +/** + * + * rct2: 0x00672AC9 + */ +void viewport_misc_paint_setup(rct_sprite *misc, int imageDirection) +{ + RCT2_CALLPROC_X(0x00672AC9, misc->unknown.x, imageDirection, misc->unknown.y, misc->unknown.z, (int)misc, 0, 0); +} + /** * Litter Paint Setup * rct2: 0x006736FC */ -void viewport_litter_paint_setup(rct_litter* litter, int image_direction, int height){ - rct_drawpixelinfo* dpi; +void viewport_litter_paint_setup(rct_litter *litter, int imageDirection) +{ + rct_drawpixelinfo *dpi; dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); - if (dpi->zoom_level != 0)return; //If zoomed at all no litter drawn + if (dpi->zoom_level != 0) return; // If zoomed at all no litter drawn // litter has no sprite direction so remove that - image_direction >>= 3; + imageDirection >>= 3; // Some litter types have only 1 direction so remove // anything that isn't required. - image_direction &= RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2 + 1]; + imageDirection &= RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2 + 1]; - uint32 image_id = image_direction + RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2]; + uint32 image_id = imageDirection + RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2]; RCT2_GLOBAL(0x9DEA52, uint16) = 0xFFFC; RCT2_GLOBAL(0x9DEA54, uint16) = 0xFFFC; - RCT2_GLOBAL(0x9DEA56, uint16) = height + 2; + RCT2_GLOBAL(0x9DEA56, uint16) = litter->z + 2; - sub_98197C(0, 0xFF, image_id, 0, height, 4, 4, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)); + sub_98197C(0, 0xFF, image_id, 0, litter->z, 4, 4, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)); } @@ -936,16 +966,16 @@ void sprite_paint_setup(uint16 eax, uint16 ecx){ switch (spr->unknown.sprite_identifier){ case SPRITE_IDENTIFIER_VEHICLE: - RCT2_CALLPROC_X(0x6D4244, spr->unknown.x, image_direction, spr->unknown.y, spr->unknown.z, (int)spr, (int)dpi, ebp); + viewport_vehicle_paint_setup((rct_vehicle*)spr, image_direction); break; case SPRITE_IDENTIFIER_PEEP: - RCT2_CALLPROC_X(0x68F0FB, spr->unknown.x, image_direction, spr->unknown.y, spr->unknown.z, (int)spr, (int)dpi, ebp); + viewport_peep_paint_setup((rct_peep*)spr, image_direction); break; case SPRITE_IDENTIFIER_MISC: - RCT2_CALLPROC_X(0x672AC9, spr->unknown.x, image_direction, spr->unknown.y, spr->unknown.z, (int)spr, (int)dpi, ebp); + viewport_misc_paint_setup(spr, image_direction); break; case SPRITE_IDENTIFIER_LITTER: - viewport_litter_paint_setup((rct_litter*)spr, image_direction, spr->unknown.z); + viewport_litter_paint_setup((rct_litter*)spr, image_direction); break; default: assert(false); diff --git a/src/peep/peep.c b/src/peep/peep.c index 09cf941597..970418f741 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -34,6 +34,7 @@ #include "peep.h" #include "staff.h" +static void sub_68F41A(rct_peep *peep, int index); static void peep_update(rct_peep *peep); static int peep_has_empty_container(rct_peep* peep); static int peep_has_food_standard_flag(rct_peep* peep); @@ -43,6 +44,7 @@ static int peep_empty_container_extra_flag(rct_peep* peep); static int peep_should_find_bench(rct_peep* peep); static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type); static void sub_693BAB(rct_peep* peep); +static void sub_693C9E(rct_peep *peep); static void peep_spend_money(rct_peep *peep, money32 amount); static void peep_give_real_name(rct_peep *peep); @@ -109,7 +111,7 @@ void peep_update_all() if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { peep_update(peep); } else { - RCT2_CALLPROC_X(0x0068F41A, 0, 0, 0, i, (int)peep, 0, 0); + sub_68F41A(peep, i); if (peep->linked_list_type_offset == SPRITE_LINKEDLIST_OFFSET_PEEP) peep_update(peep); } @@ -118,6 +120,15 @@ void peep_update_all() } } +/** + * + * rct2: 0x0068F41A + */ +static void sub_68F41A(rct_peep *peep, int index) +{ + RCT2_CALLPROC_X(0x0068F41A, 0, 0, 0, index, (int)peep, 0, 0); +} + /* some sort of check to see if peep is connected to the ground?? */ int sub_68F3AE(rct_peep* peep){ peep->var_C4++; @@ -752,7 +763,7 @@ void peep_update_sitting(rct_peep* peep){ if (!sub_68F3AE(peep))return; //691541 - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; int ebx = peep->var_37 & 0x7; @@ -2655,7 +2666,7 @@ static void peep_update_queuing(rct_peep* peep){ return; } - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (peep->action < 0xFE)return; if (peep->sprite_type == 0){ if (peep->time_in_queue >= 2000 && (0xFFFF & scenario_rand()) <= 119){ @@ -2774,7 +2785,7 @@ static void peep_update_watering(rct_peep* peep){ if (peep->sub_state == 0){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; peep->sprite_direction = (peep->var_37 & 3) << 3; @@ -2827,7 +2838,7 @@ static void peep_update_emptying_bin(rct_peep* peep){ if (peep->sub_state == 0){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; peep->sprite_direction = (peep->var_37 & 3) << 3; @@ -2959,7 +2970,7 @@ static void peep_update_picked(rct_peep* peep){ /* rct2: 0x6914CD */ static void peep_update_leaving_park(rct_peep* peep){ if (peep->var_37 != 0){ - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 2))return; peep_sprite_remove(peep); return; @@ -2981,7 +2992,7 @@ static void peep_update_leaving_park(rct_peep* peep){ window_invalidate_by_class(WC_GUEST_LIST); - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 2))return; peep_sprite_remove(peep); } @@ -2991,7 +3002,7 @@ static void peep_update_watching(rct_peep* peep){ if (peep->sub_state == 0){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; peep->destination_x = peep->x; @@ -3075,7 +3086,7 @@ static void peep_update_watching(rct_peep* peep){ */ static void peep_update_entering_park(rct_peep* peep){ if (peep->var_37 != 1){ - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if ((RCT2_GLOBAL(0xF1EE18, uint16) & 2)){ RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--; peep_sprite_remove(peep); @@ -3410,7 +3421,7 @@ static void peep_update_using_bin(rct_peep* peep){ if (peep->sub_state == 0){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; peep->sub_state = 1; @@ -3582,7 +3593,7 @@ static void peep_update_heading_to_inspect(rct_peep* peep){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 0xC))return; @@ -3692,7 +3703,7 @@ static void peep_update_answering(rct_peep* peep){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 0xC))return; @@ -3932,7 +3943,7 @@ static void peep_update_patrolling(rct_peep* peep){ if (!sub_68F3AE(peep))return; - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; if ((peep->next_var_29 & 0x18) == 8){ @@ -4058,7 +4069,7 @@ static void peep_update_walking(rct_peep* peep){ } } - RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0); + sub_693C9E(peep); if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 1))return; if ((peep->next_var_29 & 0x18) == 8){ @@ -5312,6 +5323,15 @@ void sub_693BAB(rct_peep* peep) { } } +/** + * + * rct2: 0x00693C9E + */ +static void sub_693C9E(rct_peep *peep) +{ + RCT2_CALLPROC_X(0x00693C9E, 0, 0, 0, 0, (int)peep, 0, 0); +} + /** * * rct2: 0x0069926C diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index 667897c1ba..125b686823 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -824,7 +824,7 @@ static void window_new_ride_scrollpaint() if (listItem->type != rideEntry->ride_type[1]) image_id++; } - RCT2_CALLPROC_X(0x00681DE2, 0, 29013, x + 2, y + 2, 0xA0, (int)dpi, image_id); + sub_681DE2(dpi, x + 2, y + 2, 29013, image_id); // Next position x += 116;