[ACK PATCH] Restricting save points

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [ACK PATCH] Restricting save points

by Garth's Equipment Shop » Mon Sep 07, 2009 11:29 pm

Thanks for experimenting with this rld. Your are laying the foundation for others to follow and build upon. I need to take a peek under the hood myself sometime. But I'd better keep working on my projects and get them finished first before I go biting off more than I can chew. These projects are also making me become more and more intimately familiar with the Kit so when I do take the plunge into Chris's code I will hopefully be somewhat prepared to understand what is going on in there.

[ACK PATCH] Restricting save points

by rld » 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:

Code: Select all

  #68,#16,#31&#58;begin
***   if &#40;ack.variables&#91;25&#93; = 100&#41; then
***   begin
***      if &#40;j2=#16&#41; or &#40;j2=#68&#41; then begin;shutdownsound;halt;end;
***      bottomsay&#40;1,'UNABLE TO SAVE HERE'&#41;;
***      erasebottom&#58;=3;
***   end else
***   begin
     
      say&#40;43,188,6,' SAVE GAME? &#91;Y/N&#93; '&#41;;
      ack.plregion&#58;=rgn;
      ack.plxch&#58;=xchunkloc;
      ack.plych&#58;=ychunkloc;
      ack.plxloc&#58;=xinloc;
      ack.plyloc&#58;=yinloc;
      moved&#58;=false;
      repeat
       case upcase&#40;readkey&#41; of
        'Y'&#58;begin;done&#58;=true;moved&#58;=true;end;
        'N'&#58;if &#40;&#40;j2=#16&#41; or &#40;j2=#68&#41;&#41; then begin;shutdownsound;halt;end else moved&#58;=true;
        #27&#58;begin;moved&#58;=true;j2&#58;=#31;done&#58;=false;end;
        end;
      until moved;
      if done then
       begin
        say&#40;43,188,4,'  SAVING GAME...  '&#41;;
        saveconfig;
        savemap;
        savewmap;
        fullgamesave;
		savegame_menu;
        if &#40;j2=#16&#41; or &#40;j2=#68&#41; then begin;shutdownsound;halt;end;
        say&#40;43,188,0,'                  '&#41;;
       end;
       done&#58;=false;moved&#58;=false;clearbottom;
      end;
***   end;

EDIT #2: In O_PLAY3.PAS, starting at line 1487, add the lines marked '***' below.

Code: Select all

  #68,#16,#31&#58;begin
***   if &#40;ack.variables&#91;25&#93; = 100&#41; then
***   begin
***      if &#40;j2=#16&#41; or &#40;j2=#68&#41; then begin;shutdownsound;halt;end;
***      bottomsay&#40;1,'UNABLE TO SAVE HERE'&#41;;
***      erasebottom&#58;=3;
***   end else
***   begin

      say&#40;43,188,6,' SAVE GAME? &#91;Y/N&#93; '&#41;;
      ack.plregion&#58;=rgn;
      ack.plxch&#58;=room;
      ack.plych&#58;=255;
      ack.plxloc&#58;=xloc;
      ack.plyloc&#58;=yloc;
      moved&#58;=false;
      repeat
       case upcase&#40;readkey&#41; of
        'Y'&#58;begin;done&#58;=true;moved&#58;=true;end;
        'N'&#58;if &#40;&#40;j2=#16&#41; or &#40;j2=#68&#41;&#41; then begin;shutdownsound;halt;end else moved&#58;=true;
        #27&#58;begin;moved&#58;=true;j2&#58;=#31;done&#58;=false;end;
        end;
      until moved;
      if done then
       begin
        say&#40;43,188,4,'  SAVING GAME...  '&#41;;
        saveconfig;
        savemap;
        fullgamesave;
		savegame_menu;
        if &#40;j2=#16&#41; or &#40;j2=#68&#41; then begin;shutdownsound;halt;end;
        say&#40;43,188,0,'                  '&#41;;
       end;
       done&#58;=false;moved&#58;=false;clearbottom;
      end;

***   end;

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.

Top