DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Help]Why do old savegames stop when I add this code?
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 09 Oct 2019

Topics: 46
Posts: 2335
Location: USA
usa.gif

PostPosted: Sun Jul 24, 2005 8:53 pm
   Subject: [Help]Why do old savegames stop when I add this code?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

While working on Orb, I've come across something that seems strange to me. Do you see anything in the following code snippet that would cause previous save games to no longer work?
::: CODE :::
 else if (Keyboard[sc_R])      // R = ratios
   {
      int min,sec;
     
      CenterWindow (14,5);
      // calculate the time
       sec=gamestate.TimeCount/70;
       if (sec > 99*60)      // 99 minutes max
            sec = 99*60;
       min=sec/60;
       sec%=60;
      if (min < 10)
         US_PrintUnsigned (0);
      US_PrintUnsigned (min);
      US_Print (":");
      if (sec < 10)
         US_PrintUnsigned (0);
      US_PrintUnsigned (sec);
      // ratios: k/s/t
      US_Print ("\nK:");
      US_PrintUnsigned (gamestate.killcount);
      US_Print ("/");
      US_PrintUnsigned (gamestate.killtotal);
      US_Print ("\nS:");
      US_PrintUnsigned (gamestate.secretcount);
      US_Print ("/");
      US_PrintUnsigned (gamestate.secrettotal);
      US_Print ("\nT:");
      US_PrintUnsigned (gamestate.treasurecount);
      US_Print ("/");
      US_PrintUnsigned (gamestate.treasuretotal);
      VW_UpdateScreen();
      IN_Ack();
      return 1;
   }

This, as you can guess, is in the DebugKeys section. I thought that only changes to the gamestate, actorat, etc. would stop previous savegames from working. I don't see how simply adding a display for time and the ratios would cause this to occur. I remove this code and the previous save games will work, but the new ones won't. Add it back and the new ones do, but the old ones don't. File sizes appear to match between both versions.

What am I missing?

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 23 Sep 2019

Topics: 57
Posts: 2239
Location: Canada
blank.gif

PostPosted: Sun Jul 24, 2005 11:36 pm
   Subject: Re: [Help]Why do old savegames stop when I add this code?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That was the first time you noticed this Adam?

I think it's all about the near pointers that get stored into the savegame. If you add/remove anything from near memory (variables, text strings), your WOLF3D.MAP still has to have certain things in the same place; as savegames save a few things to specific locations with pointers. When you load the savegame, it then looks for those things where the replaced savegame data told it to, instead of where they're actually directed to normally by the current exe. A good example of this would be the location of the guard AI data (directed from actorat into objlist and *next/*previous) or the static object data (*visspot).

So, if you wanted to make old savegames compatible, you'd either have to remove pointers from savegames or save the old pointer locations and realign them accordingly in LoadTheGame to fit with the new changes. I'd always check to see if WOLF3D.MAP ends off with the same amount of near databytes, or try to put your text strings and variables into far memory (like they did for alot of the menu and the spear quiz) if you want to take the easy route though.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 09 Oct 2019

Topics: 46
Posts: 2335
Location: USA
usa.gif

PostPosted: Mon Jul 25, 2005 6:59 am
   Subject: Re: [Help]Why do old savegames stop when I add this code?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Though you are probably right, I find it hard to believe since specific near variables are never put in the savegames (from what I can tell). Why would memory location make a difference when you're say "load this data to its memory location." Even if the location changes, it's still valid and old save game data would go into it. Right?

*sigh* I just don't know that much about memory handling and types and such in C. Forgive my ignorance.

I never noticed it before because the code was in such a changing state until recently. We just started beta testing maps and I added this to help with that process and noticed my saves no longer worked.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 23 Sep 2019

Topics: 57
Posts: 2239
Location: Canada
blank.gif

PostPosted: Mon Jul 25, 2005 10:20 am
   Subject: Re: [Help]Why do old savegames stop when I add this code?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yeah, the savegame issue can be quite a nuisance sometimes. There's been many occasions where I made a saved game that I wanted to use with an exe (like playing all the way to SOD level 21), then realized I wanted to change something else in the exe, and either had to recreate the saved game or had to try to make the change in a way that wouldn't affect the saved game by removing some things as well as adding them so the alignment still worked out. I seem to save my game alot for testing purposes while going on compiling frenzies, so I see this bug all the time; and generally just assume most of my older saved games don't work - lol.

Adam Biser wrote:
Even if the location changes, it's still valid and old save game data would go into it. Right?

I don't think the location it sends the data to is the problem, it's the pointer information that is inside the data you're sending. For example, the actorat uses near pointers to find the location of each guards objlist in memory. So, in the savegame, the actorat plane itself could say "look for guard 12's AI info at byte 32947", but if you then added a text string like "Hello"; that guard's info would actually start at 32952... and loading it from 32947 would lead to loading every single thing for that guard incorrectly (active, obclass, ticcount, *statecount, dir, etc.). So, bascially, everything in objlist for each guard could convert to weird numbers that don't make any sense because the pointers in actorat are telling the game to read it from the wrong memory location (5 bytes behind into guard 11's info). That's just one example though, I know this isn't the only case, because I've turned my actorat into a byte that gets sent to the correct objlist location by a calculation (to save 4096 near bytes), and there are still some pointers that get messed up when reading the savegame data - which doesn't surprise me at all when looking at some of the saved information.

This is sort of off-topic, but one time I had it so that nomatter where you saved, it would save your game at the start of the level with your original oldscore / oldhealth / oldammo / oldgun stats (to avoid people saving a million times per level). That was pretty cool, as all you needed to save was the gamestate and LevelRatios stuff, so each savegame ended up being around 192 bytes. I'd have to try that again sometime, just for fun, as I'm guessing it would be alot more backwards compatible.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 09 Oct 2019

Topics: 46
Posts: 2335
Location: USA
usa.gif

PostPosted: Mon Jul 25, 2005 2:35 pm
   Subject: Re: [Help]Why do old savegames stop when I add this code?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Thanks Chris, I forgot about the pointers in the other structures. Thanks for clearing that up for me.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 11365 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Help] Setting RocketLauncher: Explosive Range...?
Author: KyleRTCW
17 7380 Thu Jun 03, 2004 3:21 am
Codetech84 View latest post
No new posts [Help] Berserk mode
Author: wolf3dbreaker
2 2503 Tue Feb 03, 2004 11:01 pm
Xarkon View latest post
No new posts [Info] Silent Gun? - Adding a Silencer
Author: Guest
4 194 Fri Apr 18, 2003 8:34 am
BrotherTank View latest post
No new posts [Info] Adding Locked Doors
Author: Guest
3 244 Thu Apr 17, 2003 6:30 am
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group