+Karl G Posted February 8, 2020 Share Posted February 8, 2020 I believe I've figured out how I can easily generate images in the correct format from my Mac. However, I seem to be having issues with displaying a map imported with Tiled. There are no errors, but I also see no output on the screen after compiling. I'm posting the source inline, and attaching a zip of my test project here. Any ideas what I'm doing wrong here? set zoneheight 16 set doublewide on displaymode 160A set romsize 48k set screenheight 192 set pauseroutine on set basepath gfx dim TaxiX = a dim PlayerWidth = b dim TaxiInc = c dim Boolean = d dim FireButtonPressedBit0 = d dim Clock = e const screen_right = 159 const screen_left = 0 const offscreen = 200 const taxi_y = 176 P0C3=$AF: P0C1=$1A: P0C2=$0F P1C1=$0C: P1C2=$06: P1C3=$88 P2C1=$78: P2C2=$75: P2C3=$69 incgraphic taxi.png incmapfile skyscrapers.tmx TaxiX = 80 PlayerWidth = 16 TaxiInc = 2 clearscreen plotmap skyscrapers 1 0 0 20 12 savescreen drawscreen Main BACKGRND=$00 if joy0right then TaxiX = TaxiX + TaxiInc if joy0left then TaxiX = TaxiX - TaxiInc if TaxiX >= offscreen then TaxiX = screen_left if TaxiX > screen_right - PlayerWidth then TaxiX = screen_right - PlayerWidth if !joy0fire then FireButtonPressedBit0{0} = 0 : goto ____skip_joystick_button if FireButtonPressedBit0{0} then goto ____skip_joystick_button playsfx sfx_shoot FireButtonPressedBit0{0} = 1 ____skip_joystick_button restorescreen plotsprite taxi 0 TaxiX 176 drawscreen goto Main data sfx_shoot 16, 4, 1 $3, $1, $D $2, $1, $F $2, $1, $D $3, $1, $C $4, $1, $B $5, $1, $A $6, $1, $8 $7, $1, $8 $7, $1, $6 0, 0, 0 end spacelift.zip Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 8, 2020 Share Posted February 8, 2020 This is a tricky one. I've made a couple of edits relating to the map but I'm still having problems displaying it. That doesn't explain why the taxi doesn't show as is, however if I replace your restorescreen with a clearscreen the taxi does show. Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 8, 2020 Share Posted February 8, 2020 Okay the taxi not showing is down to the plotmap being one line too tall, lowering it from 12 to 11 fixes that, but still doesn't show the map. More investigation needed. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 8, 2020 Author Share Posted February 8, 2020 Maybe it's my tileset image that's to blame? Why is 12 too high? 16x12 = 192. But it seems like the invisible map is drawing over the taxi on the bottom row. Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 8, 2020 Share Posted February 8, 2020 I think plotmap counts line 0, so it ends up being 13 lines, and things drawn first will always be at the back on the 7800. Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 8, 2020 Share Posted February 8, 2020 Well, I've cut it down to a minimal example of the issue and I can't figure it out. It looks like nothing gets drawn on any line the map would appear on, even if it's only a 1 by 1 character map. P0C3=$AF: P0C1=$1A: P0C2=$0F incgraphic gfx/skyscraperstiles.png 160A 0 1 2 3 1 incgraphic gfx/taxi.png 160A 0 1 2 3 Main clearscreen plotmap test 0 0 0 1 1 plotsprite skyscraperstiles 0 24 12 plotsprite taxi 0 80 100 drawscreen goto Main data test 0,1,2,3,4,5,6,7, 0,1,2,3,4,5,6,7, 0,1,2,3,4,5,6,7, 0,1,2,3,4,5,6,7, 0,1,2,3,4,5,6,7, end Quote Link to comment Share on other sites More sharing options...
Mord Posted February 9, 2020 Share Posted February 9, 2020 For one, you haven't set your characterset. After I just added "characterset taxi" I got the taxi being drawn along with a horribly corrupted map that's obviously not correct. However you're also using plotmap instead of plotmapfile - plotmapfile is the command that generally displays imported tmx maps from tiled. 1 1 Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 9, 2020 Share Posted February 9, 2020 Aha! I'd forgotten about needing to set the characterset value, with that my minimal example works so I'll see about making the minimum changes necessary to get the actual code running. Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted February 9, 2020 Share Posted February 9, 2020 To resolve you'll need to add the below lines somewhere. characterset skyscraperstiles incgraphic skyscraperstiles.png Then on your tilemap you have to embed the tileset (there's a button in tiled to do that) otherwise it doesn't work properly, and the name of the tileset has to match the name of the graphics to use within you code so I had to change it to 'skyscraperstiles' so as to not conflict with the tilemap name. If you compare them both in a text editor you'll see what I mean. skyscrapers.tmx 1 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 9, 2020 Author Share Posted February 9, 2020 I thought importing a map file was in lieu of using the characterset command. Anyway, your last suggestions worked - thank you! 1 Quote Link to comment Share on other sites More sharing options...
Trebor Posted February 9, 2020 Share Posted February 9, 2020 "Hey, Taxi...Pad 2 Please." 3 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 11, 2020 Author Share Posted February 11, 2020 Now that I have an idea of what I'm doing, I'm enjoying making screens with Tiled. Time will tell if this turns into an actual WIP. Thanks for all of the help! 3 Quote Link to comment Share on other sites More sharing options...
SlidellMan Posted February 11, 2020 Share Posted February 11, 2020 If Silas Warner was still alive, I think he'd be proud of what you've done. 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted March 31, 2020 Author Share Posted March 31, 2020 Well, my screen had been working nicely thanks to help from people here, but I managed to break it again. Specifically, I needed to switch from 16 height tiles to 8 height, so I created a new map in Tiled with a new tileset with the correct height, and included it in my program. I also changed my zoneheight to 8, and my plotmap command to output 24 rows instead of 12. Here's what I expected to see based on my Tiled map: Here is what I actually saw in the emulator window: Obviously it is pulling from the wrong graphics data, but I don't understand why. Any ideas? I'm attaching a zip if my source and dependencies. Thanks in advance for any advice! cosmiccabbie.zip Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 31, 2020 Share Posted March 31, 2020 Best I can tell, something got messed up within the tiled tmx file itself. If you open it in a text editor, you can see these are the tilesets the map file is working with... <tileset firstgid="1" name="skyscraperstiles" tilewidth="8" tileheight="16" tilecount="0" columns="24"> <image source="skyscraperstiles.png" width="192" height="8"/> </tileset> <tileset firstgid="1" name="skyscrapers" tilewidth="8" tileheight="8" tilecount="24" columns="24"> ...notice that the tile count of the skyscraperstiles png tileset is "0". Then there's another "skyscrapers" tileset it references, but there is no "skyscrapers" png tileset - it's a map file, which is why you're getting gibberish. If I manually change the tilecount for the first tileset to 16, and change the "firstgid" of the second tileset to 16, then I see the first 16 characters as expected. So how did it get corrupted? I think at some point you must have accidentally imported a wrong file (possibly the tmx file itself or maybe a "skyscrapers.png" file you later renamed) into the tmx. 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted March 31, 2020 Author Share Posted March 31, 2020 Okay; thank you. I'm sure it got messed up my me as I was shuffling things around to switch over to the new map file. I did my own editing to get rid of the bogus tileset reference, and changed the tile count to include all of the files, and Tiled loads it fine. It almost displays correctly in the emulator now, except for two tiles. Looking at the tmx file, those two appear to be correct, and no different than neighboring tiles that are working fine. Any ideas? Thanks again for all of your help! skyscrapers.tmx Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 31, 2020 Share Posted March 31, 2020 Change the Y coordinate of your plotvalue from 12 to 24. 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted March 31, 2020 Author Share Posted March 31, 2020 Oh...yeah; the "bad tiles" were just being drawn over. Thanks again! I have everything working correctly again with the new map. Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 31, 2020 Share Posted March 31, 2020 You're totally welcome. ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.