-- file : Ck456Tli.exw -- purpose : TileInfo resource editor for Keens 4,5,6 -- version : 3.2 -- author : The CK Guy -- email : theckguy@gmail.com -- webpage : theckguy.wikispaces.com -- date : 5/06/07 -- license : FREEWARE. Anyone may distribute original Ck456Tli(v3.2).zip -- This source code is provided for educational purposes only. -- Ask *FIRST* before distributing *ANYTHING* derived from it. ------------------------------- -- SO WE CAN TALK TO WINDOWS -- ------------------------------- include win32lib.ew ------------------------- -- IGNORE ALL WARNINGS -- ------------------------- without warning --------------------------------- -- THE KNOWN VALUES OF TopFlag -- --------------------------------- constant topFlagInfo = { {#00, "Fall through", "456"}, {#00, "", "456"}, {#01, "Flat top", "456"}, {#07, "Bottom » Top", "456"}, {#06, "Bottom » Middle", "456"}, {#05, "Middle » Top", "456"}, {#04, "Top » Bottom", "456"}, {#02, "Top » Middle", "456"}, {#03, "Middle » Bottom", "456"}, {#00, "", "456"}, {#11, "Flat top with pole", "456"}, {#09, "Deadly (and can't land on in God mode)", "456"}, ---------------------------------- -- THE KNOWN VALUES OF MiscFlag -- ---------------------------------- miscFlagInfo = { {#00, "No special properties", "456"}, {#01, "Pole", "456"}, {#02, "Door, or entry to Miragia", "4"}, {#02, "Door", "56"}, {#03, "Deadly", "456"}, {#00, "", "456"}, {#15, "100 points", "456"}, {#16, "200 points", "456"}, {#17, "500 points", "456"}, {#18, "1000 points", "456"}, {#19, "2000 points", "456"}, {#1A, "5000 points", "456"}, {#1C, "Neural stunner", "456"}, {#04, "Collect 100 to get 1UP", "456"}, {#1B, "1UP", "456"}, {#00, "", "456"}, {#0F, "Switch for bridges", "45"}, {#12, "Bridge", "56"}, {#05, "Switch for moving platforms (off)", "45"}, {#06, "Switch for moving platforms (on)", "45"}, {#11, "Sprite path arrow", "56"}, {#07, "Red keygem holder", "456"}, {#08, "Yellow keygem holder", "456"}, {#09, "Blue keygem holder", "456"}, {#0A, "Green keygem holder", "456"}, {#00, "", "456"}, {#10, "\"Moon\" floor tile", "4"}, {#20, "Keycard door", "5"}, {#21, "Elevator on map (left side)", "5"}, {#22, "Elevator on map (right side)", "5"}, {#1F, "Little Ampton computer", "5"}, {#14, "Teleport entrance", "56"}, ------------------------------------ -- THE KNOWN VALUES OF BottomFlag -- ------------------------------------ bottomFlagInfo = { {#00, "Jump through", "456"}, {#00, "", "456"}, {#01, "Flat bottom", "456"}, {#04, "Bottom » Top", "456"}, {#02, "Bottom » Middle", "456"}, {#03, "Middle » Top", "456"}, {#07, "Top » Bottom", "456"}, {#06, "Top » Middle", "456"}, {#05, "Middle » Bottom", "456"}, -------------------------------------------- -- SOME TEXT USED BY THE CLIPBOARD VIEWER -- -------------------------------------------- ----------------------------------- -- VARIABLES RELATED TO THE FILE -- ----------------------------------- sequence filename, myDir integer epis, modified, grabbing --------------------------------------- -- VARIABLES RELATED TO THE TILEINFO -- --------------------------------------- integer bgTiles, fgTiles, bgTile, fgTile, tile -- total number/currently selected sequence bgData, fgData -- sequences containg all the tileinfo sequence topFlagVals, miscFlagVals, bottomFlagVals -- known dropdown values integer bgAnim, fgAnim -- offsets to next tile in animation sequence ----------------------------------------- -- VARIABLES RELATED TO THE CLIPBOARDS -- ----------------------------------------- sequence cTime, cAnim, cTop, cRight, cBottom, cLeft, cMisc, cFront --------------------------------------------- -- VARIABLES RELATED TO THE TILE SELECTION -- --------------------------------------------- integer bgPy, fgPy -- image heights integer bgOy, fgOy -- vertical offset to top of displayed portion integer offY -- offset for control-click dragging on tile selection panel atom bgPic, fgPic -- handles might not fit in a signed 32-bit integer offY = 0 -- location of tile selection panels on window constant bgCx = 5, bgCy = 210, fgCx = 5, fgCy = 210 ------------------------------------------ -- THE HIGHLY-ABUSED TEMPORARY VARIABLE -- ------------------------------------------ object t ------------------------------------------------------- -- EXTRACTS THE FLAG VALUES FROM THE CONSTANTS ABOVE -- ------------------------------------------------------- function initFlags(sequence in, atom id) end function ------------------------------------------- -- CONTROL DEFINITIONS : THE MAIN WINDOW -- ------------------------------------------- constant main = create(Window, "Ck456Tli » TileInfo resource editor for Keens 4,5,6 » Version 3.2", 0, Center, Center, 1005, 670, {WS_SYSMENU, WS_MINIMIZEBOX}), ----------------------------------------------------- -- CONTROL DEFINITIONS : THE "TileInfo File" GROUP -- ----------------------------------------------------- groupT = create(Group, "TileInfo File", main, 5, 5, 80, 632, 0), saveBtn = create(PushButton, {"Save", "Save TileInfo resource to current file"}, groupT, 10, 40, 60, 30, 0), saveAsBtn = create(PushButton, {"Save As", "Save TileInfo resource as..."}, groupT, 10, 80, 60, 30, 0), aboutBtn = create(PushButton, {"About", "About Ck456Tli v3.2"}, groupT, 10, 120, 60, 30, 0), helpBtn = create(PushButton, {"Help", "Open readme.htm"}, groupT, 10, 160, 60, 30, 0), -------------------------------------------------------- -- CONTROL DEFINITIONS : THE "Background Tiles" GROUP -- -------------------------------------------------------- groupB = create(Group, "Background Tiles", main, 95, 5, 300, 632, 0), bgTileLbl = create(CText, {"Current Tile = $ 000", "Currently selected background tile"}, groupB, 10, 20, 280, 30, 0), bgTimeLbl = create(LText, {"", "Current animation timing"}, groupB, 140, 115, 135, 20, 0), bgTimeSel = create(HScroll, {"", "Adjust timing\n(0 to 255 units)"}, groupB, 5, 170, 288, 20, 0), -------------------------------------------------------- -- CONTROL DEFINITIONS : THE "Foreground Tiles" GROUP -- -------------------------------------------------------- groupF = create(Group, "Foreground Tiles", main, 405, 5, 588, 632, 0), fgTileLbl = create(CText, {"Current Tile = $ 000", "Currently selected foreground tile"}, groupF, 10, 20, 568, 30, 0), topFlagSel = create(DropDownList, {"", "Properties of top of tile"}, groupF, 47, 50, 200, 1000, 0), leftFlagSel = create(ToggleButton, {"", "Blocks entry from left ?"}, groupF, 47, 88, 20, 64, 0), rightFlagSel = create(ToggleButton, {"", "Blocks entry from right ?"}, groupF, 227, 88, 20, 64, 0), bottomFlagSel = create(DropDownList, {"", "Properties of bottom of tile"}, groupF, 47, 170, 200, 1000, 0), miscFlagSel = create(DropDownList, {"", "Special properties of tile"}, groupF, 335, 90, 200, 1000, 0), inFrontSel = create(ToggleButton, {"FRONT", "Appears in front of sprites ?"}, groupF, 335, 120, 50, 30, 0), fgTimeLbl = create(LText, {"", "Current animation timing"}, groupF, 400, 127, 135, 20, 0), fgTimeSel = create(HScroll, {"", "Adjust timing\n(0 to 255 units)"}, groupF, 293, 170, 288, 20, 0), ------------------------------------------------------------ -- CONTROL DEFINITIONS : THE "About Ck456Tli v3.2" WINDOW -- ------------------------------------------------------------ about = create(Window, "About Ck456Tli v3.2", main, Center, Center, 400, 190, {WS_SYSMENU}), km1lbl = create(CText, "K:M", about, 20, 37, 135, 60, 0), km2lbl = create(CText, "[ a keen : modding creation ]", about, 20, 100, 135, 20, 0), aboutLbl = create(RText, "Ck456Tli » TileInfo resource editor for Keens 4,5,6\nversion 3.2 » released on May 6, 2007\nresearch by adurdin » program by The CK Guy\nMy email » theckguy@gmail.com\nMy webpage » theckguy.wikispaces.com\nVisit K:M @ www.keenmodding.org\n\nSee readme.htm before using this program.\n\nWritten in Euphoria 3.0.2 * Uses Win32Lib 0.60.6\nLearn more about Euphoria @ rapideuphoria.com", about, 130, 10, {w32Edge, -10}, {w32Edge, -10}, 0), --------------------------------------------------------- -- CONTROL DEFINITIONS : TEMPORARY OFF-SCREEN BITMAPS -- -------------------------------------------------------- ------------------------------------------------------------------------------------- -- FINDS THE FLAG VALUE IN THE LIST WE CREATED, AND SETS THE DROPDOWN MENU TO IT -- -- IF THE FLAG IS UNKNOWN, APPEND IT TO THE END OF THE LIST (SAFE FOR WEIRD FILES) -- ------------------------------------------------------------------------------------- function setDropdownIndex(integer val, sequence vals, integer control) end function ------------------------------------------- -- TAKE THE FLAG VALUES FROM THE CURRENT -- -- BACKGROUND TILE, AND SET THE CONTROLS -- ------------------------------------------- procedure bgGrabTile() end procedure --------------------------------------------------------- -- TAKE THE CURRENT SETTINGS OF THE CONTROLS, AND PUT -- -- THEM INTO THE FLAGS FOR THE CURRENT BACKGROUND TILE -- --------------------------------------------------------- procedure bgStoreTile() end procedure ------------------------------------------- -- TAKE THE FLAG VALUES FROM THE CURRENT -- -- FOREGROUND TILE, AND SET THE CONTROLS -- ------------------------------------------- procedure fgGrabTile() grabbing = 1 topFlagVals = setDropdownIndex(fgData[1][fgTile+1], topFlagVals, topFlagSel) setCheck(rightFlagSel, fgData[2][fgTile+1]) bottomFlagVals = setDropdownIndex(fgData[3][fgTile+1], bottomFlagVals, bottomFlagSel) setCheck(leftFlagSel, fgData[4][fgTile+1]) t = fgData[5][fgTile+1] if t > 127 then t -= 256 end if fgAnim = t miscFlagVals = setDropdownIndex(and_bits(fgData[6][fgTile+1], 127), miscFlagVals, miscFlagSel) end procedure --------------------------------------------------------- -- TAKE THE CURRENT SETTINGS OF THE CONTROLS, AND PUT -- -- THEM INTO THE FLAGS FOR THE CURRENT FOREGROUND TILE -- --------------------------------------------------------- procedure fgStoreTile() if length(getItem(topFlagSel, 0)) then end if fgData[2][fgTile+1] = isChecked(rightFlagSel) if length(getItem(bottomFlagSel, 0)) then end if fgData[4][fgTile+1] = isChecked(leftFlagSel) t = fgAnim if t < 0 then t += 256 end if fgData[5][fgTile+1] = t end procedure ------------------------------- -- SPECIFY THE SCROLL RANGES -- ------------------------------- setScrollRange(bgTimeSel, 0, 255) setScrollRange(fgTimeSel, 0, 255) -------------------- -- SET SOME FONTS -- -------------------- setFont(bgTileLbl, "times new roman", 14, Underline) setFont(fgTileLbl, "times new roman", 14, Underline)