Author Topic: load image  (Read 3567 times)

gwal

  • Guest
load image
« on: 2005-11-15, 06:13:08 PM »
On my game's load screen I'm trying to display a picture based on the map which the game was saved on. In other words, if the saved game was saved in "level2" then at the bottom of the screen "level2pic" would be displayed. Is there a way to do this with script?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
load image
« Reply #1 on: 2005-11-15, 07:49:38 PM »
Are you talking about the picture shown in the splash screen as the game loads or within the game?  I don't know if it could even be done in the first case, but even if it could, in either case really, it would most likely involve File System accessing.

In the latter case, the load screen wouldn't show up for any period of time anyway, so that's probably not what you want (but if it is, it could probably be done using inventory and no scripting at all, or a small amount of scripting making it easier)

In the former case, I've really got no idea....Unless you did some file renaming using the File System Object on the names of the pictures you're using.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
load image
« Reply #2 on: 2005-11-16, 06:45:28 AM »
Cool -- someone might finally be able to use yet another rarely used feature of GameDev.  This is actually relatively simple (if things work the way they were designed to work).  I won't test it out myself and show you the exact details, but I'll outline the general steps you'll need to take here:
[list=1]
  • Call CurrentDisplay.Screenshot to get a screenshot of the current display
  • Call HostObj.ExtractPic to extract a piece of it (probably surrounding the player) that is the right size for the loading screen.
  • Call HostObj.DoCommand("SavePicture", TheExtractedPicture, "LoadScreen.bmp") to save the picture over your old load screen picture.
  • [/list:o]
    If you need to explicitly draw the picture onto the screen from script because you are implementing a menuing system for loading a game that shows the screenshot, you will also want to know about the CurrentDisplay.PaintPicture function (which should probably be called in the OnAfterMoveSprites event).
    CurrentDisplay.PaintPicture Picture, X1, Y1[, Width1][, Height1][, X2][, Y2][, Width2][, Height2]

    Where is all this documented, you may ask?
  • CurrentDisplay is a property of the Engine object, which can be seen in the scripting reference.
  • The Screenshot method of the Display object is documented in the BMDXCtls documentation (because CurrentDisplay returns a BMDXDisplay object which is implemented in BMDXCtls).  You can get this by downloading the BMDXCtls source code and looking at the BMDXCtls.hlp file.
  • ExtractPic is documented in the Scripting Reference.  HostObj is a property of the Engine object which returns a ScriptHost object.  ScriptHost object has an ExtractPic method.
  • DoCommand is lightly documented in the scripting reference, but it's only used for one thing right now, and that's documented in the "What's New" for version 1.4.6.  It shows an example of using the "SavePicture" DoCommand method.
  • PaintPicture is documented as another method of the BMDXDisplay object in BMDXCtls.hlp.