-
Notifications
You must be signed in to change notification settings - Fork 1
feat: improve the chapter fleet tab #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eb5230b
b091886
a196b2a
95dac81
de6ee2d
26bd69c
dc0309a
2cd393e
c3dde49
02fe0a1
6f1fd73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ function scr_fleet_advisor(){ | |
| va = real(temp[42]); | ||
| if (va = 2) then blurp += " Two of our ships are highly damaged. You may wish to purchase a Repair License from the Sector Governerner."; | ||
| if (va > 2) then blurp += " Several of our ships are highly damaged. It is advisable that you purchase a Repair License from the Sector Governer."; | ||
| blurp += "##Here are the current positions of our ships and their contents:"; | ||
| blurp += "\n\nHere are the current positions of our ships and their contents:"; | ||
|
|
||
| if (menu_adept = 1) { | ||
| blurp = string_replace(blurp, "Our", "Your"); | ||
|
|
@@ -66,24 +66,123 @@ function scr_fleet_advisor(){ | |
|
|
||
| draw_set_font(fnt_40k_30b); | ||
| draw_set_halign(fa_center); | ||
| draw_text_transformed(xx + 1262, yy + 70, "Fleet", 0.6, 0.6, 0); | ||
| draw_text_transformed(xx + 1262, yy + 40, "Fleet", 0.6, 0.6, 0); | ||
|
|
||
| draw_set_font(fnt_40k_14); | ||
| draw_set_halign(fa_left); | ||
|
|
||
| var cn = obj_controller; | ||
|
|
||
| // TODO: Probably a good idea to turn this whole interactive list/sheet generating logic into a constructor, that can be reused on many screens. | ||
| // I have no passion for this atm. | ||
| if (instance_exists(cn)) { | ||
| var _header_offset = 80; | ||
| var _row_height = 20; | ||
| var _row_gap = 2; | ||
| var _columns = { | ||
| name: { | ||
| w: 176, | ||
| text: "Name", | ||
| h_align: fa_left, | ||
| }, | ||
| class: { | ||
| w: 154, | ||
| text: "Class", | ||
| h_align: fa_left, | ||
| }, | ||
| location: { | ||
| w: 130, | ||
| text: "Location", | ||
| h_align: fa_left, | ||
| }, | ||
| hp: { | ||
| w: 44, | ||
| text: "HP", | ||
| h_align: fa_right, | ||
| }, | ||
| carrying: { | ||
| w: 84, | ||
| text: "Carrying", | ||
| h_align: fa_right, | ||
| }, | ||
| }; | ||
|
|
||
| var _column_x = xx + 953; | ||
| var _columns_array = ["name", "class", "location", "hp", "carrying"]; | ||
|
|
||
| for (var i = 0; i < array_length(_columns_array); i++) { | ||
| with(_columns[$ _columns_array[i]]) { | ||
| x1 = _column_x; | ||
| _column_x += w; | ||
| x2 = x1 + w; | ||
| y1 = yy + _header_offset; | ||
| header_y = (y1 - 2); | ||
| switch (h_align) { | ||
| case fa_right: | ||
| header_x = x2; | ||
| break; | ||
| case fa_center: | ||
| header_x = (x1 + x2) / 2; | ||
| break; | ||
| case fa_left: | ||
| default: | ||
| header_x = x1; | ||
| break; | ||
| } | ||
| draw_set_halign(h_align); | ||
| draw_text(header_x, header_y, text); | ||
| } | ||
| } | ||
| draw_set_halign(fa_left); | ||
|
|
||
| for (var i = ship_current; i < ship_current + 34; i++) { | ||
| if (obj_ini.ship[i] != "") { | ||
| draw_rectangle(xx + 950, yy + 80 + (i * 20), xx + 1546, yy + 100 + (i * 20), 1); | ||
| draw_sprite(spr_view_small, 0, xx + 953, yy + 84 + (i * 20)); | ||
| draw_text(xx + 970, yy + 80 + (i * 20), $"{obj_ini.ship[i]} ( {obj_ini.ship_class[i]} )"); | ||
| draw_text(xx + 1222, yy + 80 + (i * 20), obj_ini.ship_location[i]); | ||
| draw_text(xx + 1372, yy + 80 + (i * 20), $"{round((obj_ini.ship_hp[i] / obj_ini.ship_maxhp[i]) * 100)}% HP"); | ||
| draw_text(xx + 1450, yy + 80 + (i * 20),$"{obj_ini.ship_carrying[i]} / {obj_ini.ship_capacity[i]} Space"); | ||
|
|
||
| if scr_hit(xx + 950,yy + 80 + (i * 20),xx + 1546,yy + 100 + (i * 20)) { | ||
| var _row_y = yy + _header_offset + (i * (_row_height + _row_gap)); | ||
| draw_rectangle(xx + 950, _row_y, xx + 1546, _row_y + _row_height, 1); | ||
|
|
||
| var _goto_button = { | ||
| x1: _columns.location.x1 - 20, | ||
| y1: _row_y + 4, | ||
| sprite: spr_view_small, | ||
| click: function() { | ||
| return point_and_click([x1, y1, x2, y2]); | ||
| } | ||
| }; | ||
| with(_goto_button) { | ||
| w = sprite_get_width(sprite); | ||
| h = sprite_get_height(sprite); | ||
| x2 = x1 + w; | ||
| y2 = y1 + h; | ||
| draw_sprite(sprite, 0, x1, y1); | ||
| } | ||
|
|
||
| with(_columns) { | ||
| name.contents = string_truncate(obj_ini.ship[i], _columns.name.w - 6); | ||
| class.contents = obj_ini.ship_class[i]; | ||
| location.contents = obj_ini.ship_location[i]; | ||
| hp.contents = $"{round(obj_ini.ship_hp[i] / obj_ini.ship_maxhp[i] * 100)}%"; | ||
| carrying.contents = $"{obj_ini.ship_carrying[i]}/{obj_ini.ship_capacity[i]}"; | ||
| } | ||
|
|
||
| for (var g = 0; g < array_length(_columns_array); g++) { | ||
| with(_columns[$ _columns_array[g]]) { | ||
| draw_set_halign(h_align); | ||
| switch (h_align) { | ||
| case fa_right: | ||
| draw_text(x2, _row_y, contents); | ||
| break; | ||
| case fa_center: | ||
| draw_text((x1 + x2) / 2, _row_y, contents); | ||
| break; | ||
| case fa_left: | ||
| default: | ||
| draw_text(x1, _row_y, contents); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if scr_hit(xx + 950, _row_y, xx + 1546, yy + 100 + (i * (_row_height + _row_gap))) { | ||
| if (cn.temp[101] != obj_ini.ship[i]) { | ||
| cn.temp[101] = obj_ini.ship[i]; | ||
| cn.temp[102] = obj_ini.ship_class[i]; | ||
|
|
@@ -112,6 +211,29 @@ function scr_fleet_advisor(){ | |
| cn.temp[119] = ""; | ||
| if (obj_ini.ship_carrying[i] > 0) then cn.temp[119] = scr_ship_occupants(i); | ||
| } | ||
| tooltip_draw($"Carrying ({cn.temp[118]}): {cn.temp[119]}"); | ||
| if (_goto_button.click()) { | ||
| obj_controller.temp[40] = obj_ini.ship[i]; | ||
| with(obj_p_fleet) { | ||
| for (var k = 0; k <= 40; k++) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without an array check length does this have a chance of causing crashes?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I haven't edited this code at all from where I copied it. |
||
| if (capital[k] == obj_controller.temp[40]) then instance_create(x, y, obj_temp7); | ||
| if (frigate[k] == obj_controller.temp[40]) then instance_create(x, y, obj_temp7); | ||
| if (escort[k] == obj_controller.temp[40]) then instance_create(x, y, obj_temp7); | ||
| } | ||
| } | ||
| if (instance_exists(obj_temp7)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is being redone can we please please deprecate the obj_temp7 usage
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I would be glad, but I have no idea what So if you know how to - you can do that and I cherry pick. Or create a separate PR, maybe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. literally instead of using arrays to compile lists of stuff the guy made instances of these crappy obj_temp7 things also used to be obj_temp4,obj_temp5,obj_temp6 but i think i've removed most of these, i can maybe do this if it's an issue |
||
| obj_controller.x = obj_temp7.x; | ||
| obj_controller.y = obj_temp7.y; | ||
| obj_controller.menu = 0; | ||
| with(obj_fleet_show) { | ||
| instance_destroy(); | ||
| } | ||
| instance_create(obj_temp7.x, obj_temp7.y, obj_fleet_show); | ||
| with(obj_temp7) { | ||
| instance_destroy(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -120,53 +242,50 @@ function scr_fleet_advisor(){ | |
| draw_set_font(fnt_40k_30b); | ||
| draw_set_halign(fa_center); | ||
| draw_text_transformed(xx + 622, yy + 434, cn.temp[101], 0.75, 0.75, 0); | ||
| draw_text_transformed(xx + 622, yy + 460, cn.temp[102], 0.5, 0.5, 0); | ||
| draw_text_transformed(xx + 622, yy + 464, cn.temp[102], 0.5, 0.5, 0); | ||
|
|
||
| draw_set_color(c_white); | ||
| draw_rectangle(xx + 498, yy + 492, xx + 746, yy + 623, 0); | ||
| draw_set_color(c_gray); | ||
| draw_rectangle(xx + 488, yy + 492, xx + 756, yy + 634, 1); | ||
| var ships = ["Battle Barge", "Strike Cruiser","Gladius","Hunter"]; | ||
| var ship_im = 0; | ||
| for (var i=0;i<array_length(ships);i++){ | ||
| if (cn.temp[102]==ships[i]){ | ||
| ship_im=i; | ||
| break; | ||
| } | ||
| if (cn.temp[102]==ships[i]){ | ||
| ship_im=i; | ||
| break; | ||
| } | ||
| } | ||
| draw_sprite(spr_ship_back_black, ship_im, xx + 390, yy + 390); | ||
| draw_set_color(c_gray); | ||
| draw_set_color(c_white); | ||
| draw_sprite(spr_ship_back_white, ship_im, xx + 488, yy + 492); | ||
|
|
||
| draw_set_color(c_gray); | ||
| draw_set_font(fnt_40k_14); | ||
| draw_set_halign(fa_left); | ||
|
|
||
| yy -= 34; | ||
|
|
||
| draw_text(xx + 383, yy + 665, $"Health: {cn.temp[103]}/{cn.temp[104]}"); | ||
| draw_text(xx + 588, yy + 665, $"Shields: {cn.temp[105]}" ); | ||
| draw_text(xx + 768, yy + 665, $"Armour: {cn.temp[107]},{cn.temp[108]}"); | ||
| draw_text(xx + 383, yy + 655, $"Health: {cn.temp[103]}/{cn.temp[104]}"); | ||
| draw_text(xx + 588, yy + 655, $"Shields: {cn.temp[105]}" ); | ||
| draw_text(xx + 768, yy + 655, $"Armour: {cn.temp[107]},{cn.temp[108]}"); | ||
|
|
||
| draw_text(xx + 485, yy + 683, $"Speed: {cn.temp[106]}"); | ||
| draw_text(xx + 678, yy + 683, $"Turrets: {cn.temp[109]}"); | ||
| draw_text(xx + 495, yy + 675, $"Speed: {cn.temp[106]}"); | ||
| draw_text(xx + 680, yy + 675, $"Turrets: {cn.temp[109]}"); | ||
|
|
||
| if (cn.temp[110] != "") { | ||
| draw_text(xx + 383, yy + 701, $"-{cn.temp[110]} ({cn.temp[111]})"); | ||
| draw_text(xx + 383, yy + 705, $"-{cn.temp[110]} ({cn.temp[111]})"); | ||
| } | ||
| if (cn.temp[112] != "") { | ||
| draw_text(xx + 383, yy + 719, "-" + cn.temp[112] + " (" + string(cn.temp[113]) + ")"); | ||
| draw_text(xx + 383, yy + 725, "-" + cn.temp[112] + " (" + string(cn.temp[113]) + ")"); | ||
| } | ||
| if (cn.temp[114] != "") { | ||
| draw_text(xx + 383, yy + 737, "-" + cn.temp[114] + " (" + string(cn.temp[115]) + ")"); | ||
| draw_text(xx + 383, yy + 745, "-" + cn.temp[114] + " (" + string(cn.temp[115]) + ")"); | ||
| } | ||
| if (cn.temp[116] != "") { | ||
| draw_text(xx + 383, yy + 755, "-" + cn.temp[116] + " (" + string(cn.temp[117]) + ")"); | ||
| draw_text(xx + 383, yy + 765, "-" + cn.temp[116] + " (" + string(cn.temp[117]) + ")"); | ||
| } | ||
|
|
||
| draw_set_font(fnt_40k_12); | ||
| draw_text_ext(xx + 352, yy + 775, $"Carrying ({cn.temp[118]}): {cn.temp[119]}", -1, 542); | ||
| // draw_text_ext(xx + 352, 775, $"Carrying ({cn.temp[118]}): {cn.temp[119]}", -1, 542); | ||
| draw_set_font(fnt_40k_14); | ||
|
|
||
| yy += 34; | ||
| } | ||
| } | ||
| // 31 wide | ||
| scr_scrollbar(1547, 100, 1577, 780, 34, ship_max, ship_current); | ||
| scr_scrollbar(1550, 100, 1577, 818, 34, ship_max, ship_current); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.