changeset 5766 | 1980eef57c7d |
parent 5761 | 4f339e6d7dd1 |
child 5768 | dded34549c8c |
5765:27dbbe543fcf | 5766:1980eef57c7d |
---|---|
36 uint16 unk61A; |
36 uint16 unk61A; |
37 uint16 unk61C; |
37 uint16 unk61C; |
38 int left, top; |
38 int left, top; |
39 uint height; |
39 uint height; |
40 StringID format_str_y_axis; |
40 StringID format_str_y_axis; |
41 byte color_3, color_2, bg_line_color; |
41 byte color_3, color_2; |
42 byte colors[GRAPH_NUM]; |
42 byte colors[GRAPH_NUM]; |
43 int64 cost[GRAPH_NUM][24]; // last 2 years |
43 int64 cost[GRAPH_NUM][24]; // last 2 years |
44 } GraphDrawer; |
44 } GraphDrawer; |
45 |
45 |
46 static const int64 INVALID_VALUE = 0x80000000; |
46 static const int64 INVALID_VALUE = 0x80000000; |
48 static void DrawGraph(const GraphDrawer *gw) |
48 static void DrawGraph(const GraphDrawer *gw) |
49 { |
49 { |
50 |
50 |
51 int i,j,k; |
51 int i,j,k; |
52 uint x,y,old_x,old_y; |
52 uint x,y,old_x,old_y; |
53 int color; |
|
54 int right, bottom; |
53 int right, bottom; |
55 int num_x, num_dataset; |
54 int num_x, num_dataset; |
56 const int64 *row_ptr, *col_ptr; |
55 const int64 *row_ptr, *col_ptr; |
57 int64 mx; |
56 int64 mx; |
58 int adj_height; |
57 int adj_height; |
63 |
62 |
64 /* the colors and cost array of GraphDrawer must accomodate |
63 /* the colors and cost array of GraphDrawer must accomodate |
65 * both values for cargo and players. So if any are higher, quit */ |
64 * both values for cargo and players. So if any are higher, quit */ |
66 assert(GRAPH_NUM >= (int)NUM_CARGO && GRAPH_NUM >= (int)MAX_PLAYERS); |
65 assert(GRAPH_NUM >= (int)NUM_CARGO && GRAPH_NUM >= (int)MAX_PLAYERS); |
67 |
66 |
68 color = _colour_gradient[gw->bg_line_color][4]; |
67 byte grid_colour = _colour_gradient[14][4]; |
69 |
68 |
70 /* draw the vertical lines */ |
69 /* draw the vertical lines */ |
71 i = gw->num_vert_lines; assert(i > 0); |
70 i = gw->num_vert_lines; assert(i > 0); |
72 x = gw->left + 66; |
71 x = gw->left + 66; |
73 bottom = gw->top + gw->height - 1; |
72 bottom = gw->top + gw->height - 1; |
74 do { |
73 do { |
75 GfxFillRect(x, gw->top, x, bottom, color); |
74 GfxFillRect(x, gw->top, x, bottom, grid_colour); |
76 x += 22; |
75 x += 22; |
77 } while (--i); |
76 } while (--i); |
78 |
77 |
79 /* draw the horizontal lines */ |
78 /* draw the horizontal lines */ |
80 i = 9; |
79 i = 9; |
81 x = gw->left + 44; |
80 x = gw->left + 44; |
82 y = gw->height + gw->top; |
81 y = gw->height + gw->top; |
83 right = gw->left + 44 + gw->num_vert_lines*22-1; |
82 right = gw->left + 44 + gw->num_vert_lines*22-1; |
84 |
83 |
85 do { |
84 do { |
86 GfxFillRect(x, y, right, y, color); |
85 GfxFillRect(x, y, right, y, grid_colour); |
87 y -= gw->height >> 3; |
86 y -= gw->height >> 3; |
88 } while (--i); |
87 } while (--i); |
89 |
88 |
90 /* draw vertical edge line */ |
89 /* draw vertical edge line */ |
91 GfxFillRect(x, gw->top, x, bottom, gw->color_2); |
90 GfxFillRect(x, gw->top, x, bottom, gw->color_2); |
186 do { |
185 do { |
187 if (!(sel & 1)) { |
186 if (!(sel & 1)) { |
188 x = gw->left + 55; |
187 x = gw->left + 55; |
189 j = gw->num_on_x_axis;assert(j>0); |
188 j = gw->num_on_x_axis;assert(j>0); |
190 col_ptr = row_ptr; |
189 col_ptr = row_ptr; |
191 color = gw->colors[i]; |
190 byte color = gw->colors[i]; |
192 old_y = old_x = INVALID_VALUE; |
191 old_y = old_x = INVALID_VALUE; |
193 do { |
192 do { |
194 cur_val = *col_ptr++; |
193 cur_val = *col_ptr++; |
195 if (cur_val != INVALID_VALUE) { |
194 if (cur_val != INVALID_VALUE) { |
196 y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top; |
195 y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top; |
341 gd.height = 136; |
340 gd.height = 136; |
342 gd.include_neg = true; |
341 gd.include_neg = true; |
343 gd.format_str_y_axis = STR_CURRCOMPACT; |
342 gd.format_str_y_axis = STR_CURRCOMPACT; |
344 gd.color_3 = 0x10; |
343 gd.color_3 = 0x10; |
345 gd.color_2 = 0xD7; |
344 gd.color_2 = 0xD7; |
346 gd.bg_line_color = 0xE; |
|
347 |
345 |
348 SetupGraphDrawerForPlayers(&gd); |
346 SetupGraphDrawerForPlayers(&gd); |
349 |
347 |
350 numd = 0; |
348 numd = 0; |
351 FOR_ALL_PLAYERS(p) { |
349 FOR_ALL_PLAYERS(p) { |
415 gd.height = 104; |
413 gd.height = 104; |
416 gd.include_neg = false; |
414 gd.include_neg = false; |
417 gd.format_str_y_axis = STR_CURRCOMPACT; |
415 gd.format_str_y_axis = STR_CURRCOMPACT; |
418 gd.color_3 = 0x10; |
416 gd.color_3 = 0x10; |
419 gd.color_2 = 0xD7; |
417 gd.color_2 = 0xD7; |
420 gd.bg_line_color = 0xE; |
|
421 SetupGraphDrawerForPlayers(&gd); |
418 SetupGraphDrawerForPlayers(&gd); |
422 |
419 |
423 numd = 0; |
420 numd = 0; |
424 FOR_ALL_PLAYERS(p) { |
421 FOR_ALL_PLAYERS(p) { |
425 if (p->is_active) { |
422 if (p->is_active) { |
488 gd.height = 104; |
485 gd.height = 104; |
489 gd.include_neg = false; |
486 gd.include_neg = false; |
490 gd.format_str_y_axis = STR_7024; |
487 gd.format_str_y_axis = STR_7024; |
491 gd.color_3 = 0x10; |
488 gd.color_3 = 0x10; |
492 gd.color_2 = 0xD7; |
489 gd.color_2 = 0xD7; |
493 gd.bg_line_color = 0xE; |
|
494 SetupGraphDrawerForPlayers(&gd); |
490 SetupGraphDrawerForPlayers(&gd); |
495 |
491 |
496 numd = 0; |
492 numd = 0; |
497 FOR_ALL_PLAYERS(p) { |
493 FOR_ALL_PLAYERS(p) { |
498 if (p->is_active) { |
494 if (p->is_active) { |
561 gd.height = 200; |
557 gd.height = 200; |
562 gd.include_neg = false; |
558 gd.include_neg = false; |
563 gd.format_str_y_axis = STR_7024; |
559 gd.format_str_y_axis = STR_7024; |
564 gd.color_3 = 0x10; |
560 gd.color_3 = 0x10; |
565 gd.color_2 = 0xD7; |
561 gd.color_2 = 0xD7; |
566 gd.bg_line_color = 0xE; |
|
567 SetupGraphDrawerForPlayers(&gd); |
562 SetupGraphDrawerForPlayers(&gd); |
568 |
563 |
569 numd = 0; |
564 numd = 0; |
570 FOR_ALL_PLAYERS(p) { |
565 FOR_ALL_PLAYERS(p) { |
571 if (p->is_active) { |
566 if (p->is_active) { |
637 gd.height = 200; |
632 gd.height = 200; |
638 gd.include_neg = false; |
633 gd.include_neg = false; |
639 gd.format_str_y_axis = STR_CURRCOMPACT; |
634 gd.format_str_y_axis = STR_CURRCOMPACT; |
640 gd.color_3 = 0x10; |
635 gd.color_3 = 0x10; |
641 gd.color_2 = 0xD7; |
636 gd.color_2 = 0xD7; |
642 gd.bg_line_color = 0xE; |
|
643 SetupGraphDrawerForPlayers(&gd); |
637 SetupGraphDrawerForPlayers(&gd); |
644 |
638 |
645 numd = 0; |
639 numd = 0; |
646 FOR_ALL_PLAYERS(p) { |
640 FOR_ALL_PLAYERS(p) { |
647 if (p->is_active) { |
641 if (p->is_active) { |
721 gd.height = 104; |
715 gd.height = 104; |
722 gd.include_neg = false; |
716 gd.include_neg = false; |
723 gd.format_str_y_axis = STR_CURRCOMPACT; |
717 gd.format_str_y_axis = STR_CURRCOMPACT; |
724 gd.color_3 = 16; |
718 gd.color_3 = 16; |
725 gd.color_2 = 215; |
719 gd.color_2 = 215; |
726 gd.bg_line_color = 14; |
|
727 gd.num_dataset = NUM_CARGO; |
720 gd.num_dataset = NUM_CARGO; |
728 gd.num_on_x_axis = 20; |
721 gd.num_on_x_axis = 20; |
729 gd.num_vert_lines = 20; |
722 gd.num_vert_lines = 20; |
730 gd.month = 0xFF; |
723 gd.month = 0xFF; |
731 gd.unk61A = 10; |
724 gd.unk61A = 10; |