Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Proper Use Of SetScreenState For Nearby Rooms

3 replies · 1,857 views · Started 05 August 2010

Back in build 1076, I used the following in a custom door script to change the screen state of nearby rooms to simulate the normal NES door mechanics.

Game->SetScreenState(Game->GetCurMap() + 1, Game->GetCurScreen() + 16 - (8 * Game->GetCurMap()), ST_DOORDOWN, true);

Although it looks complex, this code worked perfectly, which meant a few bugs were worked around (as the GetCurMap() + 1 and the 8 screen offset per map show). Since that build, changes were made to the functions that completely broke the script.

What I want to know is, what would be an updated version of the code above that works (it changes the state of the screen directly below the current one to mark the top door opened). Or has a bug been introduced that needs to be fixed/worked around?

Yes, there was a bug in Game->GetCurMap() returning the wrong map / crashing. _L_ I believe fixed this around 11**. Remove the "+ 1" and I think it should work.

[edit] Nope I was wrong:


ZScript: now, Game->GetScreenState() and Game->SetScreenState() now correctly count maps from 1 upward (as indicated in zscript.txt) rather than 0 upward.

Same fix though.

Now I think there is a bug with SetScreenState. The following works in Mac Build 1304.

Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() + 16, ST_DOORDOWN, true);
Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() - 16, ST_DOORUP, true);
Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() + 1, ST_DOORRIGHT, true);
Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() - 1, ST_DOORLEFT, true);

...at least for a while. At some point, these statements no longer function correctly. Experiementing a little, I noticed that this would work when the normal statements did not.

Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen(), ST_DOORUP, true);

The bug occurs with screens on higher Map Numbers, or possibly higher DMap Numbers (one or the other). The bug looks like SetScreenState gets offset by 16 at some point. Is this supposed to happen?