Skip to content

Commit

Permalink
release version 2.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Trylobot committed Jul 8, 2017
1 parent 41f645a commit b5ff5ca
Show file tree
Hide file tree
Showing 11 changed files with 437 additions and 157 deletions.
5 changes: 5 additions & 0 deletions release/ENG.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ m_function_preview = "Preview"
m_function_show_more = "Show More Details"
;Functions sub menu, Variant editor functions
m_function_WeaponGroups = "Set Weapon Groups"
m_function_wings = "Set Variant Wings"
m_function_vent = "Flux Vents"
m_function_vent_add = "Add Flux Vent"
m_function_vent_remove = "Remove Flux Vent"
Expand Down Expand Up @@ -212,8 +213,12 @@ h_function_launchBays_remove = "Remove Nearest Port"
h_function_ship_builtInWings_addWing = "Add Fighter Wing"
h_function_ship_builtInWings_removeWing = "Remove Fighter Wing"

h_function_ship_variantWings_addWing = "Add Fighter Wing"
h_function_ship_variantWings_removeWing = "Remove Fighter Wing"

h_function_variant_assignWeapon = "Assign Weapon"
h_function_variant_weaponGroups = "Weapon Groups"
h_function_variant_wings = "Wings"
h_function_variant_autofire = "Toggle Autofire"
h_function_variant_addVents = "Add Flux Vent"
h_function_variant_removeVents = "Remove Flux Vent"
Expand Down
18 changes: 9 additions & 9 deletions release/changes.log
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
______________________________________________________________________________
editor version 2.7.4-beta.1 (starsector 0.8.1a) [Trylobot]
editor version 2.7.4 (starsector 0.8.1a) [Deathfly & Trylobot]

FEATURES
- Ship: renders built-in wings and wing slots
- Ship: prevents adding more wings than ship has capacity for
- Variant: added "wings" mode (add/remove fighter wings from variant)
- Ship/Variant: renders fighter wing sprites and available slots
- Ship/Variant: prevents adding more wings than ship has capacity for
- Variant: warns if adding more variant wings than variant has OPs for
- Variant: added "goalVariant", "quality" to details (strings) editor

BUGFIXES
- Now saves Ship / Details / coversColor properly


- Ship: saves coversColor

______________________________________________________________________________
editor version 2.7.3 (starsector 0.8.1a) [Trylobot]
Expand Down Expand Up @@ -42,7 +42,7 @@ BUGFIXES
- In variant edit mode it will now try to create an empty new variant called "New" for edit.
- In weapon edit mode, it will create an new weapon file.
______________________________________________________________________________
editor version 2.7.0 (starsector 0.7.2a)
editor version 2.7.0 (starsector 0.7.2a) [Deathfly]

MAXGUI MIGRATION
- Add menu bar.
Expand Down Expand Up @@ -113,12 +113,12 @@ BUGFIXES
- Fixed a issue that the rjson core will mistakenly discard "0" for integer output.

______________________________________________________________________________
editor version 2.6.4 (starsector 0.7.1a)
editor version 2.6.4 (starsector 0.7.1a) [Trylobot]
- credit to zaphide for pull request!
- support for HYBRID weapon types
- support for longer weapon lists
______________________________________________________________________________
editor version 2.6.3 (starsector 0.7a RC1)
editor version 2.6.3 (starsector 0.7a RC1) [Trylobot]
- ship variants will no longer assign DECORATIVE, SYSTEM or LAUNCH_BAY weapons
______________________________________________________________________________
editor version 2.6.2 (starsector 0.6.1a)
Expand Down
137 changes: 73 additions & 64 deletions sf-ship-ed.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Include "src/TModalSetEngineSlots.type.bmx"
Include "src/TModalSetStringData.type.bmx"
Include "src/TModalLaunchBays.type.bmx"
Include "src/TModalSetVariant.type.bmx"
Include "src/TModalSetVariantWings.type.bmx"
Include "src/TModalSetSkin.type.bmx"
Include "src/TModalSetShipCSV.type.bmx"
Include "src/TModalSetWingCSV.type.bmx"
Expand Down Expand Up @@ -234,6 +235,7 @@ Global sub_set_engine_slots:TModalSetEngineSlots = New TModalSetEngineSlots
Global sub_string_data:TModalSetStringData = New TModalSetStringData
Global sub_launchbays:TModalLaunchBays = New TModalLaunchBays
Global sub_set_variant:TModalSetVariant = New TModalSetVariant
Global sub_set_variant_wings:TModalSetVariantWings = New TModalSetVariantWings
Global sub_set_skin:TModalSetSkin = New TModalSetSkin
Global sub_ship_csv:TModalSetShipCSV = New TModalSetShipCSV
Global sub_wing_csv:TModalSetWingCSV = New TModalSetWingCSV
Expand Down Expand Up @@ -274,7 +276,7 @@ Repeat
'TODO adding Events
WaitEvent()
'instaquit
escape_key_update( data )
escape_key_update()

'If EventID() <> EVENT_GADGETPAINT And EventID() <> EVENT_TIMERTICK Then Print CurrentEvent.ToString()
If Not Apprunning And EventID() <> EVENT_APPRESUME Then Continue
Expand Down Expand Up @@ -431,16 +433,18 @@ Repeat
sub_set_engine_slots.Draw( ed, data, sprite )
Case "launch_bays"
sub_launchbays.Draw( ed, data, sprite )
'Case "string_data"
'performed below
Case "preview_all"
sub_preview_all.Draw( ed, data, sprite )
'Case "string_data"
'performed below
End Select

Case "variant"
Select ed.mode
Case "normal"
sub_set_variant.Draw( ed, data, sprite )
Case "variant_wings"
sub_set_variant_wings.Draw( ed, data, sprite )
'Case "string_data"
'performed below
EndSelect
Expand Down Expand Up @@ -513,6 +517,70 @@ End

'////////////////////////////////////////////////
'MARK Function set

Function check_sub_routines% ( ed:TEditor, data:TData, sprite:TSprite )
Local hit% = True
Select ed.program_mode
Case "ship"
Select ed.mode
Case "center"
sub_set_ship_center.Update( ed, data, sprite )
Case "bounds"
sub_set_bounds.Update( ed, data, sprite )
Case "shield_center"
sub_set_shield_center.Update( ed, data, sprite )
Case "weapon_slots"
sub_set_weapon_slots.Update( ed, data, sprite )
Case "built_in_weapons"
sub_set_built_in_weapons.Update( ed, data, sprite )
Case "built_in_hullmods"
sub_set_built_in_hullmods.Update( ed, data, sprite )
Case "built_in_wings"
sub_set_built_in_wings.Update( ed, data, sprite )
Case "engine_slots"
sub_set_engine_slots.Update( ed, data, sprite )
Case "launch_bays"
sub_launchbays.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
Case "preview_all"
sub_preview_all.Update( ed, data, sprite )
End Select
Case "variant"
Select ed.mode
Case "normal"
sub_set_variant.Update( ed, data, sprite )
Case "variant_wings"
sub_set_variant_wings.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
EndSelect
Case "skin"
Select ed.mode
Case "normal"
sub_set_skin.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
EndSelect
Case "csv"
sub_ship_csv.Update( ed, data, sprite )
Case "csv_wing"
sub_wing_csv.Update( ed, data, sprite )
Case "weapon"
Select ed.mode
Case "string_data"
sub_string_data.Update( ed, data, sprite )
Default
sub_weapon.Update( ed, data, sprite )
EndSelect
Case "csv_weapon"
sub_weapon_csv.Update( ed, data, sprite )
Default
hit = False
End Select
Return hit
End Function

'MARK GAlist check
'-----------------------
' Return true if the input EventSource(Object) hit the checkes, so we can skip the rest
Expand Down Expand Up @@ -802,6 +870,8 @@ Function check_function_menu% ( ed:TEditor, data:TData, sprite:TSprite )

Case "variant"
Select EventSource()
Case functionMenuSub[MENU_MODE_VARIANT][MENU_SUBFUNCTION_VARIANT_WINGS] 'variant wings
sub_set_variant_wings.Activate( ed, data, sprite )
Case functionMenuSub[MENU_MODE_VARIANT][MENU_SUBFUNCTION_VARIANT_STRIPALL]
load_variant_data( ed, data, sprite, True ) 'strip all
Case functionMenu[MENU_FUNCTION_DETAILS]
Expand Down Expand Up @@ -829,67 +899,6 @@ Function check_function_menu% ( ed:TEditor, data:TData, sprite:TSprite )
Return hit
End Function

Function check_sub_routines% ( ed:TEditor, data:TData, sprite:TSprite )
Local hit% = True
Select ed.program_mode
Case "ship"
Select ed.mode
Case "center"
sub_set_ship_center.Update( ed, data, sprite )
Case "bounds"
sub_set_bounds.Update( ed, data, sprite )
Case "shield_center"
sub_set_shield_center.Update( ed, data, sprite )
Case "weapon_slots"
sub_set_weapon_slots.Update( ed, data, sprite )
Case "built_in_weapons"
sub_set_built_in_weapons.Update( ed, data, sprite )
Case "built_in_hullmods"
sub_set_built_in_hullmods.Update( ed, data, sprite )
Case "built_in_wings"
sub_set_built_in_wings.Update( ed, data, sprite )
Case "engine_slots"
sub_set_engine_slots.Update( ed, data, sprite )
Case "launch_bays"
sub_launchbays.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
Case "preview_all"
sub_preview_all.Update( ed, data, sprite )
End Select
Case "variant"
Select ed.mode
Case "normal"
sub_set_variant.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
EndSelect
Case "skin"
Select ed.mode
Case "normal"
sub_set_skin.Update( ed, data, sprite )
Case "string_data"
sub_string_data.Update( ed, data, sprite )
EndSelect
Case "csv"
sub_ship_csv.Update( ed, data, sprite )
Case "csv_wing"
sub_wing_csv.Update( ed, data, sprite )
Case "weapon"
Select ed.mode
Case "string_data"
sub_string_data.Update( ed, data, sprite )
Default
sub_weapon.Update( ed, data, sprite )
EndSelect
Case "csv_weapon"
sub_weapon_csv.Update( ed, data, sprite )
Default
hit = False
End Select
Return hit
End Function

'Function check_mode( ed:TEditor, data:TData, sprite:TSprite )
' If ed.program_mode = "ship"
' 'If not selecting a weapon for a built-in slot, check ESCAPE key
Expand Down
108 changes: 108 additions & 0 deletions src/TData.type.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,22 @@ Type TData
EndIf
EndMethod

'requires subsequent call to update_variant()
Method add_variant_wing( wing_id$ )
Local current_wing_count% = variant.wings.length + ship.builtInWings.length
If current_wing_count < get_fighterbays_count()
variant.wings = variant.wings[..variant.wings.length + 1]
variant.wings[variant.wings.length - 1] = wing_id
EndIf
EndMethod

'requires subsequent call to update_variant()
Method remove_last_variant_wing()
If variant.wings.length > 0
variant.wings = variant.wings[..variant.wings.length-1]
EndIf
EndMethod

'////////////////

'requires subsequent call to update_weapon()
Expand Down Expand Up @@ -912,6 +928,7 @@ Type TData

'////////////////

' counts the number of matching wings are equipped on the loaded .ship
Method count_builtin_wings%( search_wing_id$ )
Local count% = 0
For Local wing_id$ = EachIn ship.builtInWings
Expand All @@ -920,6 +937,97 @@ Type TData
Return count
EndMethod

' counts the number of matching wings are equipped on the loaded .variant
Method count_variant_wings%( search_wing_id$ )
Local count% = 0
For Local wing_id$ = EachIn variant.wings
If wing_id = search_wing_id Then count :+ 1
Next
Return count
EndMethod

Method get_wing_op_cost%( wing_id$ )
Local wing:TMap = TMap( ed.stock_wing_stats.ValueForKey( wing_id ))
Return String( wing.ValueForKey( "op cost" )).ToInt()
EndMethod

'-----------------------------------------

Method get_ship_csv_ordnance_points%()
Local ship_stats:TMap = csv_row
Local value$ = String( ship_stats.ValueForKey( "ordnance points" ))
If Not value Then Return 0 'csv row found, but did not contain column
Return value.ToInt()
EndMethod

Method calc_variant_used_ordnance_points%()
Local op% = 0
'flux vents, flux capacitors, weapons, hullmods, wings
op :+ variant.fluxVents
op :+ variant.fluxCapacitors
For Local group:TStarfarerVariantWeaponGroup = EachIn variant.weaponGroups
For Local weapon_slot_id$ = EachIn group.weapons.Keys()
Local weapon_id$ = String( group.weapons.ValueForKey( weapon_slot_id ))
If weapon_id
Local weapon_op% = get_weapon_csv_ordnance_points( weapon_id )
If Not is_weapon_assigned_to_builtin_weapon_slot( weapon_slot_id )
op :+ weapon_op
EndIf
End If
Next
Next
For Local hullMod_id$ = EachIn variant.hullMods
Local hullMod_op% = get_hullmod_csv_ordnance_points( hullMod_id )
op :+ hullMod_op
Next
For Local wing_id$ = EachIn variant.wings
Local wing_op% = get_wing_op_cost( wing_id )
op :+ wing_op
Next
Return op
EndMethod

Method is_weapon_assigned_to_builtin_weapon_slot%( weapon_slot_id$ )
For Local weapon_slot:TStarfarerShipWeapon = EachIn ship.weaponSlots
If weapon_slot.id = weapon_slot_id And weapon_slot.is_builtin()
Return True
EndIf
Next
Return False
EndMethod

Method get_weapon_csv_ordnance_points%( weapon_id$ )
Local weapon_stats:TMap = TMap( ed.stock_weapon_stats.ValueForKey( weapon_id ))
If Not weapon_stats Then Return 0 'ID not found in csv data
Local value$ = String( weapon_stats.ValueForKey( "OPs" ))
If Not value Then Return 0 'csv row found, but did not contain column
Return value.ToInt()
EndMethod

Method get_hullmod_csv_ordnance_points%( hullMod_id$ )
'uses ship size and hullmod data
Local hullMod_stats:TMap = TMap( ed.stock_hullmod_stats.ValueForKey( hullMod_id ))
If Not hullMod_stats Then Return 0 'ID not found in csv data
Local column_key$ = ""
Select ship.hullSize
Case "FRIGATE"
column_key = "cost_frigate"
Case "DESTROYER"
column_key = "cost_dest"
Case "CRUISER"
column_key = "cost_cruiser"
Case "CAPITAL_SHIP"
column_key = "cost_capital"
Default
Return 0 'hullMod cost cannot be found
EndSelect
Local value$ = String( hullMod_stats.ValueForKey( column_key ))
If Not value Then Return 0 'csv row found, but did not contain column
Return value.ToInt()
EndMethod

'-----------------------------------------

Method find_assigned_slot_parent_group:TStarfarerVariantWeaponGroup( ship_weapon_slot_id$ )
For Local group:TStarfarerVariantWeaponGroup = EachIn variant.weaponGroups
For Local assigned_slot_id$ = EachIn group.weapons.Keys()
Expand Down
1 change: 1 addition & 0 deletions src/TEditor.type.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Type TEditor
Field builtIn_hullMod_i%
Field builtIn_wing_i%
Field variant_hullMod_i%
Field variant_wing_i%
Field group_field_i%
'mouse states
Field mouse_1%
Expand Down
Loading

0 comments on commit b5ff5ca

Please sign in to comment.