Author Topic: How to scroll map editor horizontally for large tiles  (Read 8014 times)

Eastfist

  • Contributor
  • Regular
  • **
  • Posts: 54
    • View Profile
    • Eastfist - Chongchen Saelee
How to scroll map editor horizontally for large tiles
« on: 2008-12-20, 01:57:11 PM »
Hey gang,

Long time, but still kicking it.  Working on my modified version of 1.4.6 (I'll release it if I ever finish Runsetter, I want it perfect).  Ben, was wondering how you've implemented the map editor.  I've noticed that it will scroll vertically for tiles larger than the screen resolution, but not horizontally.  For example, if my screen resolution is 1024x768 and I have a bitmap that is 2048x2048 with tiles set at 1024x1024 each, then I can scroll vertically to select the tiles in view, but not the tiles not currently in view.  Here's the lines of code I've altered, but don't seem to be taking effect:

This is inside the MapEdit class...

               
               ...
               ElseIf EditMode = 1 Then
               ...

               If MouseX > HorizontalResolution - 16 Then
                    TSOffsetX = TSOffsetX + 8
                    If TSOffsetX > Disp.HimetricToPixelX(theMap.MapLayer(EditLayer).TSDef.Image.Width) - HorizontalResolution Then
                        TSOffsetX = Disp.HimetricToPixelX(theMap.MapLayer(EditLayer).TSDef.Image.Width) - HorizontalResolution
                    End If
                End If
                If MouseX < 16 Then
                    TSOffsetX = TSOffsetX - 8
                End If
                If TSOffsetX < 0 Then TSOffsetX = 0
               
                Disp.DrawTile MouseTS, 2, MouseX, MouseY, 0, 0, HorizontalResolution, VerticalResolution, True

Theoretically, it should work the same way it's drawn during runtime, so why isn't it scrolling?
"What's in a game?"  Juliet says to insult Romeo.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2752
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #1 on: 2008-12-21, 09:21:46 AM »
There are a lot more lines of code than those that refer to TSOffset, which is what determines where the tileset menu is drawn.  Did you change all of them to include the new TSOffsetX variable?

Eastfist

  • Contributor
  • Regular
  • **
  • Posts: 54
    • View Profile
    • Eastfist - Chongchen Saelee
Re: How to scroll map editor horizontally for large tiles
« Reply #2 on: 2008-12-21, 08:30:30 PM »
I did a search through the class, and realized I had to add the new offset variable to the PaintMenu method too and it's working now.  Thanks, Ben.
"What's in a game?"  Juliet says to insult Romeo.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #3 on: 2008-12-21, 09:14:29 PM »
hey! if you're not doing anything special, could you figure out a way to have SGDK1 to play music from a cd? this would be so helpful since i want to use high quality music with my RANAT game without wasting 100MB+ of disk space (it's not the space that's the problem, but the loading time and memory space).
Looking to the skies.....

Eastfist

  • Contributor
  • Regular
  • **
  • Posts: 54
    • View Profile
    • Eastfist - Chongchen Saelee
Re: How to scroll map editor horizontally for large tiles
« Reply #4 on: 2008-12-21, 10:59:44 PM »
Hey SmartBoy16,

I'm not really qualified to answer that kind of request.  But as far as I know, DirectX doesn't support MP3s anymore because quartz.dll is replaced with every new incarnation of Windows Media Player/Direct X/DirectShow and that's what SGDK uses to play media.  According to what I've read somewhere, Microsoft disabled support for MP3s in DirectX/DirectShow because they don't want developers messing with MP3 proprietary technology (I could be wrong). You could try to rollback that dll, but I doubt it'll do any good.  I've tried to find a workaround too, but no luck.  As for referencing hq audio from a cd, you can probably alter the .gdp file that is output by the app.  Open it with Notepad, find the media section and put something like this:  "E:\audiofile.wav"  Of course, you won't be able to determine which drive the user has a cd-rom installed in.

To create hq audio, use MediaCoder and convert the MP3 to a hq WMA file.  Should be compatible, I tested it.
"What's in a game?"  Juliet says to insult Romeo.

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #5 on: 2008-12-22, 12:34:26 AM »
if u have all the game files on the same discs could you use relative paths?

for example if the game file was e:/gsad.gdp, couldnt the reference to the audio file in the gdp be /music/fdasd.wav?

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #6 on: 2008-12-22, 11:05:13 AM »
if u have all the game files on the same discs could you use relative paths?

for example if the game file was e:/gsad.gdp, couldnt the reference to the audio file in the gdp be /music/fdasd.wav?

then the game would attempt to save the game on the CD. the best thing i could do though is ask the person which drive their cd player is on and then send it to them for whatever drive they use. (like, for most people, send a GDP that contains paths to D: and another person to E: )
Looking to the skies.....

Eastfist

  • Contributor
  • Regular
  • **
  • Posts: 54
    • View Profile
    • Eastfist - Chongchen Saelee
Re: How to scroll map editor horizontally for large tiles
« Reply #7 on: 2008-12-22, 12:49:18 PM »
Actually, now that I think about it, Jam0864 might be right.  As long as the paths are relative to the .gdp file, you shouldn't have to worry.  Create your project on the hard drive and when it's ready to go, then burn all the files onto a CD.  Just remember to test the CD on another computer before you distribute it because it might still reference files on the hard drive you developed the project on.
"What's in a game?"  Juliet says to insult Romeo.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #8 on: 2008-12-22, 12:56:36 PM »
that would work, but the only problem is that whenever you try to save the game it may try to save onto the CD (i think i said that before) and plus there would be loading times (but then again, that probably expected of a CD) is there a way to direct where the save file is located?
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2752
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #9 on: 2008-12-22, 06:29:54 PM »
No, I don't think you can control where the saved game goes.  That's a good point... maybe I should investigate this in SGDK2 and make sure at least in SGDK2 that it's possible for user-written content to go do the user's directory instead of the executable's directory.  That's the normal thing for modern programs now.  I just want to make sure there's no easy way for saved games to overwrite other important files.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: How to scroll map editor horizontally for large tiles
« Reply #10 on: 2008-12-23, 05:16:46 PM »
Have the programer/gamer set the location? maybe have some kind of line in the code that states the Save folder. OH!! Roller Coaster Tycoon lets you set where exactly you want to save your file via SaveAs... box. Maybe you should also have a special .sgdk2sav file that instantly starts up where you left off when you open it.


as for RANAT, i might have to compress the music files. my sound recorder that i use has a special MPEG Layer type thingy format that cuts down its size without much loss of quality. ill use that then.

Hey, over 300 posts! :D
« Last Edit: 2008-12-23, 05:22:12 PM by SmartBoy16 »
Looking to the skies.....