[ACK PATCH] Restricting save points
Posted: Mon Sep 07, 2009 12:06 pm
This code patch for the ACK player module (ACK02) is based on the ACK 3.251 release, using the procedure described in a previous post. Warning: given that I do not understand approximately 99% of the code in the ACK source package, it is entirely possible (and in fact quite likely) that modifying your ACK release as detailed below will result in horrific bugs and crashes. I take no responsibility for any aggravation that results from this.
The following edit can be used to prevent the player from being able to save the game at any random location in your adventure. Macro variable Y is used to dynamically allow or block the 'save' command; if Y<>100, the player is allowed to save the game; if Y=100, saves are blocked. This could be used to restrict saves only to certain regions (like an overworld map) or only when certain conditions apply (like the player standing on/next to a 'save point').
THE EDIT: Because there are two different modules that determine what happens when the user hits Alt+S to save (one module for world map regions and one for room map regions), this edit must be performed in two places.
EDIT #1 - In O_PLAY2.PAS, starting at line 1694, add the lines marked '***' below:
EDIT #2: In O_PLAY3.PAS, starting at line 1487, add the lines marked '***' below.
Note that this affects what happens when the player tries to quit (Alt+Q or F10) as well; if saves are blocked, this code will cause Alt+Q/F10 to result in an instant exit. A better version of this patch would probably duplicate a bit more of the existing code above and ask the player if they were sure they wanted to quit before exiting.
The following edit can be used to prevent the player from being able to save the game at any random location in your adventure. Macro variable Y is used to dynamically allow or block the 'save' command; if Y<>100, the player is allowed to save the game; if Y=100, saves are blocked. This could be used to restrict saves only to certain regions (like an overworld map) or only when certain conditions apply (like the player standing on/next to a 'save point').
THE EDIT: Because there are two different modules that determine what happens when the user hits Alt+S to save (one module for world map regions and one for room map regions), this edit must be performed in two places.
EDIT #1 - In O_PLAY2.PAS, starting at line 1694, add the lines marked '***' below:
Code: Select all
#68,#16,#31:begin
*** if (ack.variables[25] = 100) then
*** begin
*** if (j2=#16) or (j2=#68) then begin;shutdownsound;halt;end;
*** bottomsay(1,'UNABLE TO SAVE HERE');
*** erasebottom:=3;
*** end else
*** begin
say(43,188,6,' SAVE GAME? [Y/N] ');
ack.plregion:=rgn;
ack.plxch:=xchunkloc;
ack.plych:=ychunkloc;
ack.plxloc:=xinloc;
ack.plyloc:=yinloc;
moved:=false;
repeat
case upcase(readkey) of
'Y':begin;done:=true;moved:=true;end;
'N':if ((j2=#16) or (j2=#68)) then begin;shutdownsound;halt;end else moved:=true;
#27:begin;moved:=true;j2:=#31;done:=false;end;
end;
until moved;
if done then
begin
say(43,188,4,' SAVING GAME... ');
saveconfig;
savemap;
savewmap;
fullgamesave;
savegame_menu;
if (j2=#16) or (j2=#68) then begin;shutdownsound;halt;end;
say(43,188,0,' ');
end;
done:=false;moved:=false;clearbottom;
end;
*** end;
Code: Select all
#68,#16,#31:begin
*** if (ack.variables[25] = 100) then
*** begin
*** if (j2=#16) or (j2=#68) then begin;shutdownsound;halt;end;
*** bottomsay(1,'UNABLE TO SAVE HERE');
*** erasebottom:=3;
*** end else
*** begin
say(43,188,6,' SAVE GAME? [Y/N] ');
ack.plregion:=rgn;
ack.plxch:=room;
ack.plych:=255;
ack.plxloc:=xloc;
ack.plyloc:=yloc;
moved:=false;
repeat
case upcase(readkey) of
'Y':begin;done:=true;moved:=true;end;
'N':if ((j2=#16) or (j2=#68)) then begin;shutdownsound;halt;end else moved:=true;
#27:begin;moved:=true;j2:=#31;done:=false;end;
end;
until moved;
if done then
begin
say(43,188,4,' SAVING GAME... ');
saveconfig;
savemap;
fullgamesave;
savegame_menu;
if (j2=#16) or (j2=#68) then begin;shutdownsound;halt;end;
say(43,188,0,' ');
end;
done:=false;moved:=false;clearbottom;
end;
*** end;