Skip to content

Commit d7de156

Browse files
authored
Merge pull request #5 from cortex-command-community/development
Merge v1.2.2 into Master
2 parents 4dce987 + 2ba6a9c commit d7de156

12 files changed

+757
-710
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/.bmx
2-
cccp-bender-main.bmx.bak
3-
cccp-bender-main.exe
4-
cccp-bender-main.debug.exe
2+
*.exe
3+
*.bak

assets.bmx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Rem
2+
------- ASSETS --------------------------------------------------------------------------------------------------------
3+
EndRem
4+
5+
'Embed palette file for standalone exe
6+
Incbin "assets/palette"
7+
8+
'Embed logo image for standalone exe
9+
Incbin "assets/logo-image"
10+
11+
'Embed textbox contents to later load into strings
12+
Incbin "assets/about-textbox-content"
13+
Incbin "assets/help-textbox-content"

assets/about-textbox-content

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Welcome to the CCCP Bender utility!
2+
3+
It's purpose is to make the life of modders easier by automagically generating bent limb frames.
4+
5+
The CC Bender was originally created by Arne Jansson (AndroidArts), the man behind all the Cortex Command artwork.
6+
The CCCommunityProject Bender, however, is a brand new tool that allows more control and convenience for the modder (hopefully).
7+
8+
Arne's original bend code was used as base for this utility, and has been modified and improved to enable the new features.
9+
10+
Created by MaximDude using BlitzMax 0.105.3.35 and MaxIDE 1.52
11+
Bender logo image by Arne Jansson - Edited by MaximDude

assets/help-textbox-content

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
-------------------------- GUI --------------------------
2+
3+
LOAD:
4+
This loads an image file and starts bending.
5+
Supported formats are bmp, png and jpg.
6+
7+
- Note:
8+
The loaded file is being cut to 24x24px tiles internally.
9+
For best results, use provided template to create correct input files.
10+
11+
12+
SAVE:
13+
This saves the bended limbs into a file or creates a new file with specified name.
14+
15+
- Note:
16+
Files are saved in .png format, typing in the extension is not needed.
17+
Currently loaded file cannot be overwritten.
18+
19+
20+
----------------- ADJUSTING JOINTS ----------------
21+
22+
To adjust the joint positing on a limb part, click the upper joint marker on and drag it up/down, or click at desired point to set it there.
23+
Output will update automatically as you adjust the markers.
24+
25+
- Note:
26+
Joint markers cannot be adjusted on the X axis, and will adjust equally on the Y axis.
27+
For best results, please position the limb parts as close to dead center as possible for each tile in the input file.
28+
29+
30+
---------------------- SETTINGS -----------------------
31+
32+
ZOOM:
33+
This magnifies the source image For easier placement of joint markers.
34+
Zooming does Not magnify the output.
35+
Accepts values from 1 To 4.
36+
37+
- Warning:
38+
Changing zoom level will reset the joint markers to initial positions.
39+
Zoom first, adjust markers later.
40+
41+
42+
FRAMES:
43+
This sets the amount of frames output will generate.
44+
Accepts values from 1 to 20.
45+
46+
- Note :
47+
Limb bending will automatically adjust to number of frames.
48+
49+
50+
BG COLOR R,G,B:
51+
This changes the background color of the output.
52+
Accepts values from 0 to 255.
53+
54+
- Note :
55+
When saving file, the output will automatically set background to magenta, so no manual setting before saving is needed.
56+
57+
58+
SAVE AS INDEXED BITMAP:
59+
When ticked the output will be saved as a BMP file indexed to the CC palette.
60+
When not ticked, output will be saved as a non-indexed PNG.
61+
62+
- Warning :
63+
THE INDEXING PROCESS IS SLOW!
64+
I've done my best to speed it up but it still isn't blazing fast like PNG saving.
65+
When saving indexed, the app may hang and appear unresponsive but in fact it's doing what it's supposed to.
66+
For best results, DO NOT TOUCH ANYTHING until the background color reverts from magenta to whatever it was before!
File renamed without changes.

bender.bmx

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
Rem
2+
------- CORTEX COMMAND COMMUNITY PROJECT BENDER -----------------------------------------------------------------------
3+
EndRem
4+
5+
SuperStrict
6+
7+
'Import dependencies into build
8+
Import MaxGUI.Drivers
9+
Import BRL.Max2D
10+
Import BRL.Pixmap
11+
Import BRL.PNGLoader
12+
Import BRL.Stream
13+
Import BRL.EndianStream
14+
15+
'Load assets
16+
Include "assets.bmx"
17+
18+
'Include individual types
19+
Include "types/user-interface.bmx"
20+
Include "types/editor-output.bmx"
21+
Include "types/file-io.bmx"
22+
Include "types/bitmap-index.bmx"
23+
24+
'Version
25+
Global appVersion:String = "1.2.2"
26+
Global appVersionDate:String = "14 Feb 2020"
27+
28+
Rem
29+
------- BOOT ----------------------------------------------------------------------------------------------------------
30+
EndRem
31+
32+
New TAppGUI
33+
New TAppOutput
34+
New TAppFileIO
35+
New TBitmapIndex
36+
TAppGUI.FAppEditor()
37+
TAppOutput.FOutputBoot()
38+
39+
Rem
40+
------- EVENT HANDLING ------------------------------------------------------------------------------------------------
41+
EndRem
42+
43+
While True
44+
TAppOutput.FOutputUpdate()
45+
46+
If ButtonState(TAppGUI.editSettingsIndexedCheckbox) = True Then
47+
fileFilters = "Image Files:bmp"
48+
TAppFileIO.saveAsIndexed = True
49+
Else
50+
fileFilters = "Image Files:png"
51+
TAppFileIO.saveAsIndexed = False
52+
EndIf
53+
54+
WaitEvent
55+
'Print CurrentEvent.ToString()
56+
'Print GCMemAlloced()
57+
58+
'Event Responses
59+
Select EventID()
60+
Case EVENT_APPRESUME
61+
ActivateWindow(TAppGUI.editWindow)
62+
TAppOutput.FOutputUpdate()
63+
Case EVENT_WINDOWACTIVATE
64+
TAppOutput.FOutputUpdate()
65+
Case EVENT_GADGETLOSTFOCUS
66+
TAppOutput.FOutputUpdate()
67+
Case EVENT_MENUACTION
68+
Select EventData()
69+
Case TAppGUI.ABOUT_MENU
70+
AppTitle = "CCCP Bender v"+appversion
71+
Notify(LoadText("Incbin::assets/about-textbox-content"),False)
72+
EndSelect
73+
Case EVENT_GADGETACTION
74+
Select EventSource()
75+
'Quitting confirm
76+
Case TAppGUI.editQuitButton
77+
quitResult = Confirm("Quit program?")
78+
'Loading
79+
Case TAppGUI.editLoadButton
80+
TAppFileIO.FLoadFile()
81+
TAppOutput.FOutputUpdate()
82+
'Saving
83+
Case TAppGUI.editSaveButton
84+
TAppFileIO.prepForSave = True
85+
TAppOutput.FOutputUpdate()
86+
'Settings textbox inputs
87+
'Scale
88+
Case TAppGUI.editSettingsZoomTextbox
89+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsZoomTextbox).ToInt()
90+
'Foolproofing
91+
If userInputValue > 4 Then
92+
TAppOutput.INPUTZOOM = 4
93+
ElseIf userInputValue <= 0 Then
94+
TAppOutput.INPUTZOOM = 1
95+
Else
96+
TAppOutput.INPUTZOOM = userInputValue
97+
EndIf
98+
SetGadgetText(TAppGUI.editSettingsZoomTextbox,TAppOutput.INPUTZOOM)
99+
TAppOutput.TILESIZE = 24 * TAppOutput.INPUTZOOM
100+
TAppOutput.redoLimbTiles = True
101+
TAppOutput.FOutputUpdate()
102+
'Frames
103+
Case TAppGUI.editSettingsFramesTextbox
104+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsFramesTextbox).ToInt()
105+
'Foolproofing
106+
If userInputValue > 20 Then
107+
TAppOutput.FRAMES = 20
108+
ElseIf userInputValue <= 0 Then
109+
TAppOutput.FRAMES = 1
110+
Else
111+
TAppOutput.FRAMES = userInputValue
112+
EndIf
113+
SetGadgetText(TAppGUI.editSettingsFramesTextbox,TAppOutput.FRAMES)
114+
TAppOutput.FOutputUpdate()
115+
'Bacground Color
116+
'Red
117+
Case TAppGUI.editSettingsColorRTextbox
118+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorRTextbox).ToInt()
119+
'Foolproofing
120+
If userInputValue > 255 Then
121+
TAppOutput.BACKGROUND_RED = 255
122+
ElseIf userInputValue < 0 Then
123+
TAppOutput.BACKGROUND_RED = 0
124+
Else
125+
TAppOutput.BACKGROUND_RED = userInputValue
126+
EndIf
127+
SetGadgetText(TAppGUI.editSettingsColorRTextbox,TAppOutput.BACKGROUND_RED)
128+
TAppOutput.FOutputUpdate()
129+
'Green
130+
Case TAppGUI.editSettingsColorGTextbox
131+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorGTextbox).ToInt()
132+
'Foolproofing
133+
If userInputValue > 255 Then
134+
TAppOutput.BACKGROUND_GREEN = 255
135+
ElseIf userInputValue < 0 Then
136+
TAppOutput.BACKGROUND_GREEN = 0
137+
Else
138+
TAppOutput.BACKGROUND_GREEN = userInputValue
139+
EndIf
140+
SetGadgetText(TAppGUI.editSettingsColorGTextbox,TAppOutput.BACKGROUND_GREEN)
141+
TAppOutput.FOutputUpdate()
142+
'Blue
143+
Case TAppGUI.editSettingsColorBTextbox
144+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorBTextbox).ToInt()
145+
'Foolproofing
146+
If userInputValue > 255 Then
147+
TAppOutput.BACKGROUND_BLUE = 255
148+
ElseIf userInputValue < 0 Then
149+
TAppOutput.BACKGROUND_BLUE = 0
150+
Else
151+
TAppOutput.BACKGROUND_BLUE = userInputValue
152+
EndIf
153+
SetGadgetText(TAppGUI.editSettingsColorBTextbox,TAppOutput.BACKGROUND_BLUE)
154+
TAppOutput.FOutputUpdate()
155+
EndSelect
156+
'Quitting confirm
157+
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
158+
quitResult = Confirm("Quit program?")
159+
EndSelect
160+
'Quitting
161+
If quitResult Then Exit
162+
EndWhile
File renamed without changes.

0 commit comments

Comments
 (0)