Outils pour utilisateurs

Outils du site


agi-game:leisuresuitlarry:reference-timer

Ceci est une ancienne révision du document !


Timing and Timers

Larry is using a lot of timing and timer, their are all handled by logic0.

#define varTimeLastElapsedSeconds     v43
#define varTimingDelay                v67
#define varClearStatusSeconds         v68
#define varTimerSpraySeconds          v71
#define varTimerSprayMinutes          v72
#define varTimerBreathSpraySeconds    v80
#define varSecondsSinceKeystroke      v91
#define varGameTimeSecond             v115
#define varGameTimeMinute             v116
#define varGameTimeHour               v119

Due to the “unsigned byte” architecture of the AGI virtual machine, to avoid loop in timer (when timer goes below 0 their new value is set to '255', not -1); this is due to the fact that AGI doesn't handle negative variables very well.

In game Time

The timing Handler increase seconds , until seconds reach 60. (To avoid the “loop” effect).

#define varGameTimeSecond             v115
#define varGameTimeMinute             v116
#define varGameTimeHour               v119

The Time is also handled by variables v119 [H], v116 [M] and v115 [S] those variables are set to start the ingame clock at 10pm and has a special even if reach 4am (larry's kill himself, that the BAD ending of the game).

To reach this bad ending the player should wait +6h in real time, some screens/logics doesn't affect change in-game time (title, BadEnding and Questionnaires) but the seconds counter is always incremented byte the timeloop.

According to the source code; it can be an issue if you're in that room (seconds could be over 60) but those 3 screens aren't really play screen.

Timers

Leisure suit larry is using at least 4 differents timers

varTimingDelay [v67]

#define varTimingDelay                v67

This timer is used by any room logic to set a timer (example, if larry won't move, after few second the dog came in).

This timer only raise (Set) the boolTimingScriptDone [f75] when reach 1 second left (not 0, to avoid loop to 255 (-1) value).

Any room logic can change the variable to what value they want to wait, and pool the boolTimingScriptDone [f75] flag for raise.

The timing Handler decrease the value until it's reach 1.

varClearStatusSeconds [v68]

This timer is used to clear part of the line #24 when reach 1 second left.

It's used to clear bottom line.

  if (varClearStatusSeconds == 1)                    lear lower part of the screen half line (line 24)
    {
    clear.text.rect(24, 0, 24, 15, BLACK);
    }

varTimerSprayMinutes [v72] & varTimerSpraySeconds [v71]

The timing Handler decrease the varTimerSpraySeconds [v71] value until it's reach 0 (it can'nt be negative).

If the varTimerSprayMinutes [v72] is > 0; the handler decrease varTimerSprayMinutes [v72], and reset varTimerSpraySeconds [v71] to 60.

It's somehow related to breath spray (10:00)…

when v71 == 1 and v72 == 0 (timer is over), then handler raise flag boolMouthSmellBad [f107] and reset boolMouthOK [f66].

it display message 157 to 160, and preset the next message in the list, loop to 157 if message > 160.

    if (varTimerSprayMinutes > 0 && 
        varTimerSpraySeconds <= 0)
      {
      --varTimerSprayMinutes;
      varTimerSpraySeconds = 60;  
      }
 
 
    if (varTimerSpraySeconds == 1 && 
        varTimerSprayMinutes <= 0)
      {
      reset(boolMouthOK);
      set(boolMouthSmellBad);
      print.v(varMouthMessage);
      ++varMouthMessage;
      if (varMouthMessage > 160)
        {
        varMouthMessage = 157;
        }
      }

varTimerBreathSpraySeconds [v80]

The timing Handler decrease the value until it's reach 1.

It's started when Larry use his breath spray when boolDisabledRoomJump (f48) is set or in the currentRoom 0.

When this timer hit 1 second left, the player re-gain the larry's control.

it's also reset boolKeepCycling [f34] flag.

    if (varTimerBreathSpraySeconds == 1)
      {
      reset(boolDisabledRoomJump);
      reset(boolKeepCycling);
      set.view(ego, Larry_StandAndWalk);
      start.motion(ego);
      reset(boolDisablePlayer);
      accept.input();
      print("Ahhh.");
      }
agi-game/leisuresuitlarry/reference-timer.1619984555.txt.gz · Dernière modification : 2021/05/02 21:42 de frater