Skip to content

Commit 14e257e

Browse files
committed
swars: Fixed a bug in map drawing projector
Some X coords were repeated in place of Y, causing some points appear on diagonal axis of the screen rather than at proper place.
1 parent 3bc77c7 commit 14e257e

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

src/feworld.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,25 @@ TbBool draw_world_landmass_projector_startup(struct ScreenBox *box)
109109
short tx, ty;
110110
short x2, y2;
111111

112-
lbDisplay.DrawFlags = 0x0004;
113112
tx = box->Timer2 * (word_1C488A[i] + box->X - proj_origin.X);
114113
ty = box->Timer2 * (word_1C4896[i] + box->Y - proj_origin.Y);
115114
x2 = proj_origin.X + (tx / 24);
116115
y2 = proj_origin.Y + (ty / 24);
117-
draw_line_purple_list(proj_origin.X, proj_origin.Y, x2, y2, 174);
118116

117+
lbDisplay.DrawFlags = Lb_SPRITE_TRANSPAR4;
118+
draw_line_purple_list(proj_origin.X, proj_origin.Y, x2, y2, 174);
119119
lbDisplay.DrawFlags = 0;
120120
draw_sprite_purple_list(x2 - 1, y2 - 1, &unk3_sprites[12]);
121+
121122
tx = box->Timer2 * (word_1C48A2[i] + box->X - proj_origin.X);
122123
ty = box->Timer2 * (word_1C48AE[i] + box->Y - proj_origin.Y);
123-
x2 = proj_origin.X + tx / 24;
124-
x2 = proj_origin.Y + ty / 24;
125-
126-
lbDisplay.DrawFlags = 0x0004;
127-
draw_line_purple_list(proj_origin.X, proj_origin.Y, x2, x2, 174);
124+
x2 = proj_origin.X + (tx / 24);
125+
y2 = proj_origin.Y + (ty / 24);
128126

127+
lbDisplay.DrawFlags = Lb_SPRITE_TRANSPAR4;
128+
draw_line_purple_list(proj_origin.X, proj_origin.Y, x2, y2, 174);
129129
lbDisplay.DrawFlags = 0;
130-
draw_sprite_purple_list(x2 - 1, x2 - 1, &unk3_sprites[12]);
130+
draw_sprite_purple_list(x2 - 1, y2 - 1, &unk3_sprites[12]);
131131
}
132132
box->Timer2 += box->DrawSpeed;
133133
return (box->Timer2 >= 24);
@@ -650,21 +650,32 @@ void show_worldmap_screen(void)
650650

651651
void init_world_screen_boxes(void)
652652
{
653+
short scr_w, start_x;
654+
655+
scr_w = lbDisplay.GraphicsWindowWidth;
656+
653657
init_screen_box(&world_landmap_box, 7u, 72u, 518u, 354, 6);
654658
init_screen_text_box(&world_city_info_box, 534u, 72u, 99u, 354, 6, small_med_font, 3);
655659
init_screen_button(&world_info_ACCEPT_button, 548u, 384u, gui_strings[436], 6,
656660
med2_font, 1, 0);
657661
init_screen_button(&world_info_CANCEL_button, 548u, 405u, gui_strings[437], 6,
658662
med2_font, 1, 0);
659-
world_info_ACCEPT_button.X = world_city_info_box.X
660-
+ ((world_city_info_box.Width - world_info_ACCEPT_button.Width) >> 1);
661-
world_info_CANCEL_button.X =
662-
((world_city_info_box.Width - world_info_CANCEL_button.Width) >> 1) + world_city_info_box.X;
663+
663664
world_city_info_box.DrawTextFn = ac_show_world_city_info_box;
664665
world_city_info_box.Flags |= 0x4000;
665666
world_info_CANCEL_button.CallBackFn = ac_do_unkn2_CANCEL;
666667
world_info_ACCEPT_button.CallBackFn = ac_do_unkn2_ACCEPT;
667668
world_landmap_box.SpecialDrawFn = ac_show_world_landmap_box;
669+
670+
start_x = (scr_w - world_landmap_box.Width - world_city_info_box.Width - 23) / 2;
671+
672+
world_landmap_box.X = start_x + 7;
673+
world_city_info_box.X = world_landmap_box.X + world_landmap_box.Width + 9;
674+
675+
world_info_ACCEPT_button.X = world_city_info_box.X
676+
+ ((world_city_info_box.Width - world_info_ACCEPT_button.Width) >> 1);
677+
world_info_CANCEL_button.X = world_city_info_box.X
678+
+ ((world_city_info_box.Width - world_info_CANCEL_button.Width) >> 1);
668679
}
669680

670681
void reset_world_screen_boxes_flags(void)

0 commit comments

Comments
 (0)