├── bin
└── ladconf.com
├── images
├── playing.png
└── mainmenu.png
├── src
├── ladutils.pas
├── ladvar.pas
├── ladconst.pas
├── ladder.pas
├── ladfield.pas
├── ladtype.pas
├── ladmain.pas
├── ladactor.pas
├── ladprocs.pas
└── ladicons.pas
├── README.md
└── LICENSE
/bin/ladconf.com:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mecparts/Ladder/HEAD/bin/ladconf.com
--------------------------------------------------------------------------------
/images/playing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mecparts/Ladder/HEAD/images/playing.png
--------------------------------------------------------------------------------
/images/mainmenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mecparts/Ladder/HEAD/images/mainmenu.png
--------------------------------------------------------------------------------
/src/ladutils.pas:
--------------------------------------------------------------------------------
1 | {
2 | Some terminal routines not handled by Turbo Pascal.
3 |
4 | CursOff: turn the cursor off (set the string in LADCONST.PAS)
5 | CursOn: turn the cursor on (set the string in LADCONST.PAS)
6 | Beep: ring the terminal bell
7 | }
8 |
9 | PROCEDURE CursOff;
10 | BEGIN
11 | Write(CursOffStr);
12 | END;
13 |
14 | PROCEDURE CursOn;
15 | BEGIN
16 | Write(CursOnStr);
17 | END;
18 |
19 | PROCEDURE Beep;
20 | BEGIN
21 | IF sound THEN
22 | Write(#7);
23 | END;
24 |
25 |
--------------------------------------------------------------------------------
/src/ladvar.pas:
--------------------------------------------------------------------------------
1 | VAR
2 | dispensers : DispenserPointerType; { rock dispensers linked list }
3 | numDispensers : INTEGER; { # of dispensers on current level }
4 | lastScore : INTEGER; { score from last completed game }
5 | playSpeed : INTEGER;
6 | m : MapDataType;
7 | lad : ActorType;
8 | ladXY : XYtype; { starting position of lad }
9 | nextNewLad : INTEGER; { score for next new lad awarded }
10 | dataFileContents : DataFileType;
11 | highScores : ARRAY[1..NumHighScores] OF HighScoreType;
12 | sound : BOOLEAN; { TRUE for sound }
13 | insults : BOOLEAN; { TRUE for insults }
14 | levelCycle : INTEGER;
15 | displayLevel : INTEGER; { displayed map level }
16 | upKey, downKey, leftKey, rightKey : CHAR; { lad direction control keys }
17 |
18 |
--------------------------------------------------------------------------------
/src/ladconst.pas:
--------------------------------------------------------------------------------
1 | CONST
2 | Version = '1.33TP';
3 | DataFileName = 'LADDER.DAT';
4 | ConfigFileName = 'LADCONF.COM';
5 | NumHighScores = 5; { # of stored high scores }
6 | DataFileStrLength = 31; { # chars in data file terminal config strings }
7 | DataFileNameLength = 29; { # chars in high score names }
8 | CursOffStr = #$1B'[?25l'; { turn cursor off string }
9 | CursOnStr = #$1B'[?25h'; { turn cursor on string }
10 | NumPlaySpeeds = 5; { # of different playing speeds }
11 | BonusTimeDecInterval = 3000; { decrement bonus time every 3 seconds }
12 |
13 | NumLevels = 7; { # of distinct levels }
14 | LevelRows = 20; { # of rows in a level map }
15 | LevelCols = 79; { # of chars in a level map }
16 | MaxDispensers = 3; { max # of rock dispensers on a level }
17 |
18 | JumpsLen = 6; { max # of positions in a jump sequence }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/ladder.pas:
--------------------------------------------------------------------------------
1 | {$C-}
2 | {$I-}
3 | {
4 | Ladder: a reimplementation in Turbo Pascal of the classic
5 | CP/M game "Ladder", originally written by Yahoo Software (not
6 | Yahoo!).
7 |
8 | Ladder is an ASCII character based platform arcade game similar to
9 | Donkey Kong. You travel through levels with platforms and ladders
10 | where rocks fall down from the top while you collect statues
11 | before reaching the exit.
12 |
13 | This program is free software; you can redistribute it and/or modify
14 | it under the terms of the GNU General Public License as published by
15 | the Free Software Foundation; either version 2 of the License, or
16 | (at your option) any later version.
17 |
18 | This program is distributed in the hope that it will be useful,
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | GNU General Public License for more details.
22 | }
23 | PROGRAM ladder;
24 |
25 | {$I LADCONST}
26 | {$I LADTYPE}
27 | {$I LADVAR}
28 | {$I LADICONS}
29 | {$I LADUTILS}
30 | {$I LADFIELD}
31 | {$I LADACTOR}
32 | {$I LADPROCS}
33 | {$I LADMAIN}
34 |
35 |
--------------------------------------------------------------------------------
/src/ladfield.pas:
--------------------------------------------------------------------------------
1 | { LoadMap loads one of the playfields/maps into memory and also }
2 | { returns the coordinates of the initial Lad, and an array of }
3 | { coordinates where the dispensers are. }
4 | PROCEDURE LoadMap(VAR lad : XYtype; VAR dispensers : DispenserPointerType; VAR numDispensers : INTEGER);
5 | VAR
6 | x, y : INTEGER;
7 | newDispenser : DispenserPointerType;
8 | dispenserPtr : DispenserPointerType;
9 | rock1Ptr,rock2Ptr : RockPointerType;
10 | BEGIN
11 | { get rid of anay previous rock dispensers }
12 | WHILE dispensers <> NIL DO BEGIN
13 | dispenserPtr := dispensers^.next;
14 | DISPOSE(dispensers);
15 | dispensers := dispenserPtr;
16 | END;
17 | IF m.Level > NumLevels THEN BEGIN
18 | ClrScr;
19 | WriteLN('Level ', m.Level, ' out of range');
20 | CursOn;
21 | Halt;
22 | END;
23 | WITH levels[m.Level] DO BEGIN
24 | m.Name := Name;
25 | m.InitialBonusTime := InitialBonusTime;
26 | m.NumRocks := rocks;
27 |
28 | { dispose of any previous rocks }
29 | WHILE m.Rocks <> NIL DO BEGIN
30 | rock1Ptr := m.Rocks^.Next;
31 | Dispose(m.Rocks);
32 | m.Rocks := rock1Ptr;
33 | END;
34 | { allocate new rocks }
35 | FOR x := 1 TO Rocks DO BEGIN
36 | rock1Ptr := m.Rocks;
37 | New(rock2Ptr);
38 | m.Rocks := rock2Ptr;
39 | m.Rocks^.Next := rock1Ptr;
40 | END;
41 | m.AnyRocksPending := TRUE;
42 | END;
43 | { Prepare the field to be loaded with a new level }
44 | FOR y := 1 TO LevelRows DO
45 | FOR x := 1 TO LevelCols DO
46 | m.Field[y][x] := ' ';
47 | dispensers := NIL;
48 | numDispensers := 0;
49 | FOR y := 1 TO LevelRows DO
50 | FOR x := 1 TO LevelCols DO
51 | CASE levels[m.Level].layout[y][x] OF
52 | 'p':
53 | BEGIN
54 | { The lad will be put there by the rendered, so no need to have }
55 | { it on the map }
56 | lad.x := x;
57 | lad.y := y;
58 | END;
59 | 'V':
60 | BEGIN
61 | m.Field[y][x] := 'V';
62 | NEW(newDispenser);
63 | newDispenser^.xy.x := x;
64 | newDispenser^.xy.y := y;
65 | newDispenser^.next := dispensers;
66 | dispensers := newDispenser;
67 | numDispensers := Succ(numDispensers);
68 | END;
69 | '.': { TODO - handle the rubber balls }
70 | m.Field[y][x] := '.'
71 | ELSE
72 | m.Field[y][x] := levels[m.Level].layout[y][x];
73 | END;
74 | END;
75 |
76 |
--------------------------------------------------------------------------------
/src/ladtype.pas:
--------------------------------------------------------------------------------
1 | TYPE
2 | Str80Type = STRING[80];
3 | ScoreType = (ScoreReset, ScoreRock, ScoreStatue, ScoreMoney);
4 |
5 | NameStringType = STRING[20];
6 | LayoutType = ARRAY[1..LevelRows] OF ARRAY[1..LevelCols] OF CHAR;
7 | LevelType = RECORD
8 | Name : NameStringType;
9 | InitialBonusTime : INTEGER;
10 | Rocks : INTEGER;
11 | Layout : LayoutType;
12 | END;
13 |
14 | { The Action constants define what the Actor currently is, }
15 | { or is requested to be, doing }
16 | ActionType = (
17 | PENDING,
18 | NONE,
19 | STOPPED,
20 | UP,
21 | UPRIGHT,
22 | RIGHT,
23 | DOWNRIGHT,
24 | DOWN,
25 | DOWNLEFT,
26 | LEFT,
27 | UPLEFT,
28 | FALLING,
29 | JUMP, { Generic jump set by keyhandler }
30 | JUMPRIGHT,
31 | JUMPUP,
32 | JUMPLEFT,
33 | ACTIONEND
34 | );
35 |
36 | ActionArrayType = ARRAY[1..JumpsLen] OF ActionType;
37 |
38 | KindType = ( ALAD, AROCK );
39 |
40 | RockPointerType = ^ActorType;
41 | { The Actor struct holds info about an actor ie, the Lad or a Rock }
42 | ActorType = RECORD
43 | AType : KindType;
44 | X,Y : INTEGER;
45 | Ch : CHAR;
46 | Dir, DirRequest : ActionType;
47 | JumpStep : INTEGER;
48 | Next : RockPointerType;
49 | END;
50 |
51 | { The MapData hold all info about a map }
52 | MapDataType = RECORD
53 | Name : NameStringType;
54 | Field : LayoutType;
55 | LadsRemaining : INTEGER;
56 | NumRocks : INTEGER;
57 | Rocks : RockPointerType;
58 | AnyRocksPending : BOOLEAN;
59 | Level : INTEGER;
60 | Score : INTEGER;
61 | InitialBonusTime : INTEGER;
62 | RemainingBonusTime : INTEGER;
63 | ScoreText : Str80type;
64 | END;
65 |
66 | XYtype = RECORD
67 | x, y : INTEGER;
68 | END;
69 |
70 | DispenserPointerType = ^DispenserType;
71 | DispenserType = RECORD
72 | xy : XYtype;
73 | next : DispenserPointerType;
74 | END;
75 |
76 | { layout of LADDER.DAT data file }
77 | DataFileType = RECORD
78 | TerminalName : STRING[DataFileStrLength];
79 | MoveCsrPrefix : STRING[DataFileStrLength];
80 | MoveCsrSeparator : STRING[DataFileStrLength];
81 | MoveCsrSuffix : STRING[DataFileStrLength];
82 | UnkEscSeq : STRING[DataFileStrLength]; { not sure what this is... initialization? }
83 | ClrScrStr : STRING[DataFileStrLength];
84 | Flags : ARRAY[0..DataFileStrLength] OF CHAR;
85 | Keys : ARRAY[0..DataFileStrLength] OF CHAR;
86 | Highs : ARRAY[1..NumHighScores] OF ARRAY[0..DataFileStrLength] OF BYTE;
87 | Unused1 : ARRAY[0..DataFileStrLength] OF BYTE;
88 | Unused2 : ARRAY[0..DataFileStrLength] OF BYTE; { padding to next 128 bytes }
89 | Unused3 : ARRAY[0..DataFileStrLength] OF BYTE;
90 | END;
91 |
92 | HighScoreType = RECORD
93 | Score : INTEGER;
94 | Name : STRING[DataFileNameLength];
95 | END;
96 |
97 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ladder
2 | The classic CP/M game Ladder reverse engineered in Turbo Pascal.
3 |
4 | #### This is a rewrite in Turbo Pascal of the classic CP/M game "Ladder", originally written by Yahoo Software (not Yahoo!).
5 |
6 | 
7 |
8 | Ladder is an ASCII character based platform arcade game similar to
9 | Donkey Kong. You travel through levels with platforms and ladders
10 | where rocks fall down from the top while you collect statues
11 | before reaching the exit.
12 |
13 | 
14 |
15 | Back in 1999 Stephen Ostermiller made a version of [Ladder in
16 | Java](http://ostermiller.org/ladder/). Later, Mats Engstrom of
17 | SmallRoomLabs started another version in of [Ladder in
18 | golang](https://github.com/SmallRoomLabs/ladder). Between my own
19 | memories of playing the original game on a Kaypro, and Stephen
20 | Ostermiller's and Mats Engstrom's code, I was able to come up
21 | with this version.
22 |
23 | This version will use the original LADCONF.COM configuration program
24 | and LADDER.DAT configuration file. Since this version is a Turbo
25 | Pascal program, the terminal configuration portion of LADCONF
26 | isn't used, though it still does set up the movement keys, sound
27 | and back chatter options.
28 |
29 | ## Compiling the game
30 |
31 | You'd need Turbo Pascal, of course. You'll also need to edit
32 | LADCONST.PAS to set the cursor on and off sequences for your
33 | terminal. LADDER.PAS is the main part of the program. I've
34 | successfully compiled this on a 58K CP/M system, so available RAM
35 | isn't a particularly critical limitation.
36 |
37 | Once you've compiled LADDER.COM, copy LADCONF.COM to the same user area.
38 | If you don't have a LADDER.DAT file, when you run LADDER the first time
39 | it'll automatically load LADCONF to set up the movement keys and
40 | options, then transfer you back to LADDER.
41 |
42 | ## Limitations
43 |
44 | At the moment, once you've successfully completed the 7th distinct level
45 | (Gang Land), the program just cycles through all 7 seven levels over and
46 | over again until the bonus time becomes too short to actually finish a
47 | level. If anyone knows what the original program actually did (I never
48 | managed to get anywhere near to completing the original game), let me
49 | know and I'll see what I can do.
50 |
51 | The Delay(ms) call in Turbo Pascal only works for a Z80 running
52 | at up to 32MHz (and TINST will only allow you to specify a value of up
53 | to 20MHZ if I recall correctly). So if you're trying to run this on a
54 | system with an effective clock speed of greater than 32MHz, you're going
55 | to have to come up with another mechanism. That's not an insurmountable
56 | roadblock though; on my 144MHz-Z80-equivalent RunCPM box running on a
57 | Teensy 4.0, I patched the Turbo Pascal runtime to make a call to a BDOS
58 | extension I created to call the Arduino's delay() function. Works like
59 | a charm. If your system includes any kind of millisecond counter you can
60 | read, that's a good spot to start looking.
61 |
62 | ## References
63 |
64 | [Original Ladder game](http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/lambda/soundpot/f/ladder13.lbr)
65 | [Ladder in Java](http://ostermiller.org/ladder/)
66 | [Ladder in golang](https://github.com/SmallRoomLabs/ladder)
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/ladmain.pas:
--------------------------------------------------------------------------------
1 | {
2 | Note that this code makes free use of the dreaded GOTO command.
3 | }
4 | VAR
5 | msecs, bonusTimeTicks, moveInterval, x, y : INTEGER;
6 | ch : CHAR;
7 | rockPtr : RockPointerType;
8 |
9 | LABEL
10 | restartGame, restartLevel, newLevel;
11 |
12 | BEGIN { MAIN }
13 | dispensers := NIL; { initialize our linked lists for dispenser }
14 | m.Rocks := NIL; { and rocks }
15 | lastScore := -1;
16 | playSpeed := 1;
17 | ReadDataFile;
18 |
19 | restartGame:
20 |
21 | m.LadsRemaining := 5;
22 | m.Level := 1;
23 | m.Score := 0;
24 | levelCycle := 1;
25 | displayLevel := 1;
26 | nextNewLad := 100;
27 | CursOn;
28 | Randomize;
29 | MainMenu;
30 | moveInterval := ReadmsWait[playSpeed];
31 | ClrScr;
32 | CursOff;
33 |
34 | newLevel:
35 |
36 | { Load a level and show it }
37 | LoadMap(ladXY, dispensers, numDispensers);
38 |
39 | restartLevel:
40 |
41 | m.RemainingBonusTime := m.InitialBonusTime - 2 * (levelCycle - 1);
42 | InitActor(lad, ALAD, ladXY);
43 | DisperseRocks;
44 |
45 | { Show the initial map on screen }
46 | DrawMap;
47 | msecs := 0;
48 | bonusTimeTicks := 0;
49 |
50 | WHILE TRUE DO BEGIN
51 |
52 | Delay(1);
53 | msecs := Succ(msecs);
54 | IF msecs >= moveInterval THEN BEGIN
55 | { move the Lad and rocks every X milliseconds }
56 | msecs := 0;
57 | bonusTimeTicks := bonusTimeTicks + moveInterval;
58 | IF bonusTimeticks >= BonusTimeDecInterval THEN BEGIN
59 | { every 3 seconds, decrement the bonus time/time remaining value }
60 | bonusTimeTicks := bonusTimeTicks - BonusTimeDecInterval;;
61 | m.RemainingBonusTime := Pred(m.RemainingBonusTime);
62 | GotoXY(74, 21);
63 | Write(m.RemainingBonusTime : 2);
64 | IF m.RemainingBonusTime <=0 THEN BEGIN
65 | { died: do the animation and check if we still have lives left }
66 | IF LadDeath THEN
67 | GOTO restartLevel;
68 | GOTO restartGame;
69 | END;
70 | END;
71 |
72 | IF m.AnyRocksPending THEN BEGIN
73 | { pending rocks? see if it's time to start moving }
74 | rockPtr := m.Rocks;
75 | m.AnyRocksPending := FALSE;
76 | WHILE rockPtr <> NIL DO BEGIN
77 | IF (rockPtr^.Dir = PENDING) THEN
78 | IF (Random(10) = 0) THEN
79 | rockPtr^.DirRequest := FALLING
80 | ELSE
81 | m.AnyRocksPending := TRUE;
82 | rockPtr := rockPtr^.Next;
83 | END;
84 | END;
85 |
86 | { Move the lad according to players wishes }
87 | IF (lad.Dir <> STOPPED) OR (lad.DirRequest <> NONE) THEN BEGIN
88 | x := lad.X; y := lad.Y;
89 | GotoXY(x, y); Write(m.Field[y][x]);
90 | MoveActor(lad);
91 | GotoXY(lad.X, lad.Y); Write(lad.Ch);
92 | IF (x <> lad.X) AND (y = lad.Y) THEN BEGIN
93 | { get rid of disappearing flooring }
94 | IF m.Field[y + 1][x] = '-' THEN BEGIN
95 | m.Field[y + 1][x] := ' ';
96 | GotoXY(x, y + 1); Write(' ');
97 | END;
98 | END;
99 |
100 | CASE m.Field[lad.Y][lad.X] OF
101 |
102 | '$' : BEGIN { at the Gold: level done }
103 | UpdateScore(ScoreMoney);
104 | displayLevel := Succ(displayLevel);
105 | IF (m.Level > levelCycle) OR (m.Level = NumLevels) THEN BEGIN
106 | { done with current cycle, recycle to 1st level }
107 | m.Level := 1;
108 | levelCycle := SUCC(levelCycle);
109 | END ELSE BEGIN
110 | m.Level := Succ(m.Level);
111 | END;
112 | GOTO newLevel;
113 | END;
114 |
115 | '^': BEGIN { death by fire }
116 | IF LadDeath THEN
117 | GOTO restartLevel;
118 | GOTO restartGame;
119 | END;
120 |
121 | '&': BEGIN
122 | { found a statue, adjust the score, remove the statue }
123 | UpdateScore(ScoreStatue);
124 | m.Field[lad.Y][lad.X] := ' ';
125 | END;
126 |
127 | '.': BEGIN {trampoline: choose a random direction }
128 | CASE Random(5) OF
129 | 0: BEGIN
130 | lad.Dir := LEFT;
131 | lad.DirRequest := NONE;
132 | lad.JumpStep := 0;
133 | END;
134 | 1: BEGIN
135 | lad.Dir := RIGHT;
136 | lad.DirRequest := NONE;
137 | lad.JumpStep := 0;
138 | END;
139 | 2: BEGIN
140 | lad.Dir := JUMPUP;
141 | lad.DirRequest := STOPPED;
142 | lad.JumpStep := 1;
143 | END;
144 | 3: BEGIN
145 | lad.Dir := JUMPLEFT;
146 | lad.DirRequest := LEFT;
147 | lad.JumpStep := 1;
148 | END;
149 | 4: BEGIN
150 | lad.Dir := JUMPRIGHT;
151 | lad.DirRequest := RIGHT;
152 | lad.JumpStep := 1;
153 | END;
154 | END;
155 | END;
156 | END;
157 | END; { of Lad movement handler -------------------------- }
158 |
159 | { Move the rock(s) }
160 | rockPtr := m.Rocks;
161 | WHILE rockPtr <> NIL DO BEGIN
162 | { Don't draw the rock if it's pending }
163 | IF rockPtr^.Dir <> PENDING THEN BEGIN
164 | IF Collision(rockPtr) THEN
165 | IF LadDeath THEN
166 | GOTO restartLevel
167 | ELSE
168 | GOTO restartGame;
169 | x := rockPtr^.X;
170 | y := rockPtr^.Y;
171 | GotoXY(x, y);
172 | Write(m.Field[y][x]);
173 | END;
174 | MoveActor(rockPtr^);
175 | { Don't draw the rock if it's pending }
176 | IF rockPtr^.Dir <> PENDING THEN BEGIN
177 | IF Collision(rockPtr) THEN
178 | IF LadDeath THEN
179 | GOTO restartlevel
180 | ELSE
181 | GOTO restartGame;
182 | GotoXY(rockPtr^.X, rockPtr^.Y);
183 | Write(rockPtr^.Ch);
184 | END;
185 | rockPtr := rockPtr^.Next;
186 | END; { of rock movement handler ------------------------- }
187 | { end of tick handler =================================== }
188 | END;
189 | IF KeyPressed THEN BEGIN
190 | Read(Kbd, ch);
191 | ch := UpCase(ch);
192 | IF ch = leftKey THEN BEGIN
193 | lad.DirRequest := LEFT
194 | END ELSE IF ch = rightKey THEN BEGIN
195 | lad.DirRequest := RIGHT
196 | END ELSE IF ch = upKey THEN BEGIN
197 | lad.DirRequest := UP
198 | END ELSE IF ch = downKey THEN BEGIN
199 | lad.DirRequest := DOWN
200 | END ELSE IF ch = ' ' THEN BEGIN
201 | lad.DirRequest := JUMP;
202 | END ELSE IF ch = #$1B THEN BEGIN
203 | CursOn;
204 | GotoXY(1, 23); Write('Type RETURN to continue: ');
205 | REPEAT
206 | WHILE NOT KeyPressed DO;
207 | Read(Kbd, ch);
208 | UNTIL ch IN [#$0D, #$03];
209 | IF ch = #$03 THEN { ^C goes back to main menu }
210 | GOTO restartGame;
211 | GotoXY(1, 23); ClrEOL;
212 | CursOff;
213 | END ELSE IF ch = #$03 THEN BEGIN
214 | GOTO restartGame
215 | END ELSE BEGIN
216 | lad.DirRequest := STOPPED
217 | END;
218 | END; { of keypress handler ================================ }
219 | END;
220 | END.
221 |
222 |
--------------------------------------------------------------------------------
/src/ladactor.pas:
--------------------------------------------------------------------------------
1 | {
2 | ReverseDirection makes the actor to go in the opposite direction,
3 | it only works when the actor is moving left or right
4 | }
5 | PROCEDURE ReverseDirection(VAR a : ActorType);
6 | BEGIN
7 | CASE a.Dir OF
8 | LEFT : a.Dir := RIGHT;
9 | RIGHT : a.Dir := LEFT;
10 | END;
11 | END;
12 |
13 | {
14 | OnSolid returns true if standing on something solid i.e. Floor,
15 | Disappearing floor or a Ladder
16 | }
17 | FUNCTION OnSolid(a : ActorType) : BOOLEAN;
18 | BEGIN
19 | OnSolid := (m.Field[a.Y + 1][a.X] IN ['=', '-', 'H', '|'])
20 | OR (m.Field[a.Y][a.X] = 'H');
21 | END;
22 |
23 | FUNCTION EmptySpace(x, y : INTEGER) : BOOLEAN;
24 | BEGIN
25 | IF (x < 1) OR (x > LevelCols) THEN
26 | EmptySpace := TRUE
27 | ELSE
28 | EmptySpace := NOT (m.Field[y][x] IN ['|', '=']);
29 | END;
30 |
31 | {
32 | OnLadder returns true when the actor is a on a Ladder
33 | }
34 | FUNCTION OnLadder(a : ActorType) : BOOLEAN;
35 | BEGIN
36 | OnLadder := m.Field[a.Y][a.X] = 'H';
37 | END;
38 |
39 | {
40 | AboveLadder returns true when the actor is a above a Ladder
41 | }
42 | FUNCTION AboveLadder(a : ActorType) : BOOLEAN;
43 | BEGIN
44 | AboveLadder := m.Field[a.Y + 1][a.X] = 'H';
45 | END;
46 |
47 | {
48 | OnEater returns true when the actor is standing on a Eater
49 | }
50 | FUNCTION OnEater(a : ActorType) : BOOLEAN;
51 | BEGIN
52 | OnEater := m.Field[a.Y][a.X] = '*';
53 | END;
54 |
55 | {
56 | ClampToPlayfield makes sure that if the actor tries to walk or jump off
57 | the playfield edges the actor stays inside the playfield and starts falling
58 | }
59 | PROCEDURE ClampToPlayfield(VAR a : ActorType);
60 | BEGIN
61 | IF a.Dir IN [LEFT, JUMPLEFT] THEN BEGIN
62 | IF a.X < 1 THEN BEGIN
63 | a.X := 1;
64 | a.Dir := STOPPED;
65 | a.DirRequest := NONE;
66 | END;
67 | END;
68 |
69 | IF a.Dir IN [RIGHT, JUMPRIGHT] THEN BEGIN
70 | IF a.X > LevelCols THEN BEGIN
71 | a.X := LevelCols;
72 | a.Dir := STOPPED;
73 | a.DirRequest := NONE;
74 | END;
75 | END;
76 | END;
77 |
78 | {
79 | InitActor set the fields of an Actor type to reasonable
80 | initial values
81 | }
82 | PROCEDURE InitActor(VAR a : ActorType; t : KindType; xy : XYtype);
83 | BEGIN
84 | a.AType := t;
85 | a.X := xy.x;
86 | a.Y := xy.y;
87 | a.Ch := 'X';
88 | a.JumpStep := 0;
89 | CASE t OF
90 | ALAD:
91 | BEGIN
92 | a.Ch := 'g';
93 | a.Dir := STOPPED;
94 | a.DirRequest := NONE;
95 | END;
96 | AROCK:
97 | BEGIN
98 | a.Ch := 'o';
99 | a.Dir := PENDING;
100 | a.DirRequest := NONE;
101 | END;
102 | END;
103 | END;
104 |
105 | {
106 | Set the Lad's character based on their current direction
107 | }
108 | PROCEDURE UpdateLadChar(VAR a : ActorType);
109 | BEGIN
110 | WITH a DO
111 | CASE Dir OF
112 | STOPPED: Ch := 'g';
113 | RIGHT, JUMPRIGHT: Ch := 'p';
114 | LEFT, JUMPLEFT: Ch := 'q';
115 | FALLING: Ch := 'b';
116 | UP, DOWN: Ch := 'p';
117 | JUMP:
118 | CASE a.DirRequest OF
119 | NONE, STOPPED: Ch := 'g';
120 | RIGHT, JUMPRIGHT: Ch := 'p';
121 | LEFT, JUMPLEFT: Ch := 'q';
122 | END;
123 | END;
124 | END;
125 |
126 | {
127 | Update an actor's direction to the latest's request
128 | }
129 | PROCEDURE UpdateDir(VAR a : ActorType);
130 | BEGIN
131 | a.Dir := a.DirRequest;
132 | a.DirRequest := NONE;
133 | END;
134 |
135 | {
136 | MoveActor handles the movements of an Actor
137 | }
138 | PROCEDURE MoveActor(VAR a : ActorType);
139 | LABEL
140 | loopAgain;
141 | VAR
142 | jd : ActionType;
143 | i : INTEGER;
144 | dispenser : DispenserPointerType;
145 | BEGIN
146 |
147 | loopAgain: { If just started falling we need to retest all conditions }
148 |
149 | { A STONE can only be LEFT/RIGHT/DOWN/FALLING or PENDING }
150 | IF a.AType = AROCK THEN BEGIN
151 | IF (a.Dir = PENDING) AND (a.DirRequest = NONE) THEN
152 | EXIT;
153 |
154 | { If stopped select a random direction }
155 | IF a.Dir = STOPPED THEN BEGIN
156 | CASE Random(2) OF
157 | 0: IF (a.X > 1) THEN
158 | IF EmptySpace(a.X - 1, a.Y) THEN
159 | a.DirRequest := LEFT
160 | ELSE
161 | a.DirRequest := RIGHT
162 | ELSE
163 | a.DirRequest := RIGHT;
164 | 1: IF (a.X < LevelCols) THEN
165 | IF EmptySpace(a.X + 1, a.Y) THEN
166 | a.DirRequest := RIGHT
167 | ELSE
168 | a.DirRequest := LEFT
169 | ELSE
170 | a.DirRequest := LEFT;
171 | END;
172 | END;
173 |
174 | { Just reverse direction if at the playfield edge }
175 | IF (a.X = 1) OR (a.X = LevelCols) THEN
176 | ReverseDirection(a);
177 |
178 | { Start to fall if not on solid ground }
179 | IF (a.Dir <> FALLING) AND NOT OnSolid(a) THEN
180 | a.DirRequest := FALLING;
181 |
182 | { If Der rock just rolled over the top of a ladder then randomize direction }
183 | IF a.Dir IN [LEFT, RIGHT] THEN BEGIN
184 | IF AboveLadder(a) THEN
185 | CASE Random(3) OF
186 | 1: IF a.Dir = LEFT THEN
187 | a.DirRequest := RIGHT
188 | ELSE
189 | a.DirRequest := LEFT;
190 | 2: a.DirRequest := DOWN;
191 | END
192 | ELSE IF OnLadder(a) THEN
193 | CASE Random(2) OF
194 | 1: IF a.Dir = LEFT THEN
195 | a.DirRequest := RIGHT
196 | ELSE
197 | a.DirRequest := LEFT;
198 | END;
199 | END;
200 |
201 | { If on an Eater kill the stone }
202 | IF OnEater(a) THEN BEGIN
203 | dispenser := dispensers;
204 | IF numDispensers > 1 THEN BEGIN
205 | FOR i := 1 TO Random(numDispensers) DO
206 | dispenser := dispenser^.next;
207 | END;
208 | InitActor(a, AROCK, dispenser^.xy);
209 | m.AnyRocksPending := TRUE;
210 | END;
211 | END; { of stone only handling --------------------- }
212 |
213 | { If stopped or going left or going right and }
214 | { request to do something else, then try to do it }
215 | IF (a.DirRequest <> NONE) THEN BEGIN
216 | CASE a.Dir OF
217 | STOPPED, PENDING:
218 | IF a.DirRequest IN [LEFT, RIGHT, UP, DOWN, FALLING] THEN
219 | UpdateDir(a);
220 |
221 | JUMPUP:
222 | IF a.DirRequest = LEFT THEN
223 | a.Dir := JUMPLEFT
224 | ELSE IF a.DirRequest = RIGHT THEN
225 | a.Dir := JUMPRIGHT;
226 |
227 | RIGHT:
228 | IF a.DirRequest IN [LEFT, STOPPED] THEN
229 | UpdateDir(a);
230 |
231 | LEFT:
232 | IF a.DirRequest IN [RIGHT, STOPPED] THEN
233 | UpdateDir(a);
234 |
235 | UP, DOWN:
236 | IF a.DirRequest IN [STOPPED, UP, DOWN, RIGHT, LEFT] THEN
237 | UpdateDir(a);
238 |
239 | JUMPUP:
240 | IF a.DirRequest = LEFT THEN
241 | a.Dir := JUMPLEFT
242 | ELSE
243 | a.Dir := JUMPRIGHT;
244 |
245 | JUMPRIGHT, JUMPLEFT:
246 | IF a.DirRequest = STOPPED THEN
247 | UpdateDir(a);
248 |
249 | PENDING:
250 | UpdateDir(a);
251 |
252 | END;
253 | END;
254 |
255 | { Handle starting of jumps }
256 | IF (a.DirRequest = JUMP) THEN BEGIN
257 | IF OnSolid(a) THEN BEGIN
258 | CASE a.Dir OF
259 |
260 | STOPPED, FALLING: BEGIN
261 | a.DirRequest := STOPPED;
262 | a.Dir := JUMPUP;
263 | a.JumpStep := 1;
264 | END;
265 |
266 | LEFT: BEGIN
267 | a.DirRequest := a.Dir;
268 | a.Dir := JUMPLEFT;
269 | a.JumpStep := 1;
270 | END;
271 |
272 | JUMPLEFT: BEGIN
273 | a.DirRequest := LEFT;
274 | a.Dir := JUMPLEFT;
275 | a.JumpStep := 1;
276 | END;
277 |
278 | RIGHT: BEGIN
279 | a.DirRequest := a.Dir;
280 | a.Dir := JUMPRIGHT;
281 | a.JumpStep := 1;
282 | END;
283 |
284 | JUMPRIGHT: BEGIN
285 | a.DirRequest := RIGHT;
286 | a.Dir := JumpRIGHT;
287 | a.JumpStep := 1;
288 | END;
289 | END
290 | END ELSE BEGIN
291 | CASE a.Dir OF
292 | JUMPUP, FALLING: a.DirRequest := STOPPED;
293 | JUMPRIGHT: a.DirRequest := RIGHT;
294 | JUMPLEFT: a.DirRequest := LEFT;
295 | END;
296 | END;
297 | END ELSE IF (a.DirRequest = UP) AND (m.Field[a.Y][a.X] = 'H') THEN BEGIN
298 | { If at a ladder and want to go up }
299 | a.Dir := UP;
300 | a.DirRequest := NONE;
301 | END ELSE IF(a.DirRequest = DOWN) AND
302 | ((m.Field[a.Y][a.X] = 'H') OR (m.Field[a.Y + 1][a.X] = 'H')) THEN BEGIN
303 | a.Dir := DOWN;
304 | a.DirRequest := NONE;
305 | END;
306 |
307 | CASE a.Dir OF
308 |
309 | JUMPUP, JUMPLEFT, JUMPRIGHT: BEGIN
310 | { Do the jumping }
311 | jd := jumpPaths[a.Dir, a.JumpStep];
312 | IF (a.X + dirs[jd].x >= 1) AND (a.X + dirs[jd].x <= LevelCols) THEN BEGIN
313 | CASE m.Field[a.Y + dirs[jd].y][a.X + dirs[jd].x] OF
314 |
315 | '=', '|', '-' : BEGIN
316 | { If bumped into something try falling }
317 | IF OnSolid(a) THEN BEGIN
318 | a.Dir := a.DirRequest;
319 | a.DirRequest := NONE;
320 | END ELSE BEGIN
321 | CASE a.Dir OF
322 | JUMPUP: a.DirRequest := STOPPED;
323 | JUMPRIGHT: a.DirRequest := RIGHT;
324 | JUMPLEFT: a.DirRequest := LEFT;
325 | END;
326 | a.Dir := FALLING;
327 | END;
328 | a.JumpStep := 0;
329 | END;
330 |
331 | 'H': BEGIN { Jumping onto a ladder }
332 | a.Y := a.Y + dirs[jd].y;
333 | a.X := a.X + dirs[jd].x;
334 | a.Dir := STOPPED;
335 | a.DirRequest := NONE;
336 | a.JumpStep := 0;
337 | END;
338 |
339 | ELSE BEGIN
340 | { Just jumping in air }
341 | a.X := a.X + dirs[jd].x;
342 | a.Y := a.Y + dirs[jd].y;
343 | a.JumpStep := SUCC(a.JumpStep);
344 | IF (a.JumpStep > JumpsLen) THEN BEGIN
345 | UpdateDir(a);
346 | a.JumpStep := 0;
347 | END ELSE IF (jumpPaths[a.Dir][a.JumpStep] = ACTIONEND) THEN BEGIN
348 | UpdateDir(a);
349 | a.JumpStep := 0;
350 | END;
351 | END;
352 | END;
353 | END ELSE BEGIN
354 | IF OnSolid(a) THEN BEGIN
355 | a.Dir := a.DirRequest;
356 | a.DirRequest := NONE;
357 | END ELSE BEGIN
358 | a.Dir := FALLING;
359 | a.DirRequest := STOPPED;
360 | a.JumpStep := 0;
361 | END;
362 | END;
363 | END;
364 |
365 | STOPPED:
366 | IF NOT OnSolid(a) THEN
367 | a.Dir := FALLING;
368 |
369 | FALLING: BEGIN
370 | { If falling then continue doing that until not in free space anymore, }
371 | { then continue the previous direction (if any) }
372 | IF OnSolid(a) THEN
373 | IF a.DirRequest = NONE THEN
374 | a.DirRequest := STOPPED
375 | ELSE
376 | a.Dir := a.DirRequest
377 | ELSE
378 | a.Y := Succ(a.Y);
379 | END;
380 |
381 | UP:
382 | { Climb up until ladder is no more }
383 | IF m.Field[a.Y - 1][a.X] IN ['H', '&', '$'] THEN
384 | a.Y := Pred(a.Y)
385 | ELSE
386 | a.Dir := STOPPED;
387 |
388 | DOWN:
389 | { Climb down until ladder is no more }
390 | IF a.Dir = DOWN THEN
391 | IF m.Field[a.Y + 1][a.X] IN ['H', '&', '$', ' ', '^', '.'] THEN
392 | a.Y := Succ(a.Y)
393 | ELSE
394 | a.Dir := STOPPED;
395 |
396 | LEFT: BEGIN
397 | { Stepped out into the void? Then start falling, }
398 | { but remember the previous direction }
399 | IF NOT OnSolid(a) THEN BEGIN
400 | a.DirRequest := a.Dir;
401 | a.Dir := FALLING;
402 | GOTO loopAgain;
403 | END;
404 | IF EmptySpace(a.X - 1, a.Y) THEN
405 | a.X := Pred(a.X)
406 | ELSE
407 | a.DirRequest := STOPPED;
408 | END;
409 |
410 | RIGHT: BEGIN
411 | { Stepped out into the void? Then start falling, }
412 | { but remember the previous direction }
413 | IF NOT OnSolid(a) THEN BEGIN
414 | a.DirRequest := a.Dir;
415 | a.Dir := FALLING;
416 | GOTO loopAgain;
417 | END;
418 | IF EmptySpace(a.X + 1, a.Y) THEN
419 | a.X := Succ(a.X)
420 | ELSE
421 | a.DirRequest := STOPPED;
422 | END;
423 | END;
424 |
425 | { Don't allow actor to end up outside of the playfield }
426 | ClampToPlayfield(a);
427 | IF a.AType = ALAD THEN
428 | UpdateLadChar(a);
429 | END;
430 |
--------------------------------------------------------------------------------
/src/ladprocs.pas:
--------------------------------------------------------------------------------
1 | PROCEDURE Instructions;
2 | BEGIN
3 | ClrScr;
4 | WriteLN;
5 | WriteLN('You are a Lad trapped in a maze. Your mission is is to explore the');
6 | WriteLN('dark corridors never before seen by human eyes and find hidden');
7 | WriteLN('treasures and riches');
8 | WriteLN;
9 | WriteLN('You control Lad by typing the direction buttons and jumping by');
10 | WriteLN('typing SPACE. But beware of the falaling rocks called Der rocks.');
11 | WriteLN('You must find and grasp the treasures (shown as $) BEFORE the');
12 | WriteLN('bonus time runs out.');
13 | WriteLN;
14 | WriteLN('A new Lad will be awarded for every 10,000 points.');
15 | WriteLN('Extra points are awarded for touching the gold');
16 | WriteLN('statues (shown as &). You will receive the bonus time points');
17 | WriteLN('that are left when you have finished the level.');
18 | WriteLN;
19 | WriteLN('Type an ESCape to pause the egame.');
20 | WriteLN;
21 | WriteLN('Remember, there is more than one way to skin a cat. (Chum)');
22 | WriteLN;
23 | WriteLN('Good luck Lad.');
24 | WriteLN;
25 | WriteLN;
26 | WriteLN;
27 | Write('Type RETURN to return to main menu: ');
28 | Read;
29 | END;
30 |
31 | PROCEDURE ConfigureLadder;
32 | VAR
33 | configPgm : FILE;
34 | Ok : BOOLEAN;
35 | BEGIN
36 | {$I-}
37 | Assign(configPgm, ConfigFileName);
38 | WriteLN('Linking to configuration program');
39 | Execute(configPgm);
40 | Ok := IOresult = 0; { IOresult must be called after failed Execute }
41 | {$I+}
42 | WriteLN;
43 | WriteLN('Unable to link to LADCONF.COM');
44 | WriteLN('Ladder configuration program missing');
45 | Halt;
46 | END;
47 |
48 | PROCEDURE MainMenu;
49 | VAR
50 | ch : CHAR;
51 | insult : BOOLEAN;
52 | i, msecs : INTEGER;
53 | configPgm : FILE;
54 | BEGIN
55 | REPEAT
56 | ClrScr;
57 | WriteLN(' LL dd dd');
58 | WriteLN(' LL dd dd tm');
59 | WriteLN(' LL aaaa ddddd ddddd eeee rrrrrrr');
60 | WriteLN(' LL aa aa dd dd dd dd ee ee rr rr');
61 | WriteLN(' LL aa aa dd dd dd dd eeeeee rr');
62 | WriteLN(' LL aa aa dd dd dd dd ee rr');
63 | WriteLN(' LLLLLLLL aaa aa ddd dd ddd dd eeee rr');
64 | WriteLN;
65 | WriteLN(' Version : ', Version);
66 | WriteLN('(c) 1982, 1983 Yahoo Software Terminal: ', dataFileContents.TerminalName);
67 | WriteLN('10970 Ashton Ave. Suite 312 Play speed: ', playSpeed);
68 | Write( 'Los Angeles, Ca 90024 ');
69 | WriteLN('Up = ', upKey, ' Down = ',downKey ,' Left = ', leftKey, ' Right = ', rightKey);
70 | WriteLN(' Jump = Space Stop = Other');
71 | WriteLN;
72 | WriteLN('P = Play game High Scores');
73 | WriteLN('L = Change level of difficulty');
74 | WriteLN('C = Configure Ladder');
75 | WriteLN('I = Instructions');
76 | WriteLN('E = Exit Ladder');
77 | WriteLN;
78 | WriteLN;
79 | Write('Enter one of the above: ');
80 | { show high scores }
81 | FOR i := 1 TO NumHighScores DO BEGIN
82 | GotoXY(40, i + 15);
83 | Write(i, ') ');
84 | IF highScores[i].Score <> 0 THEN
85 | Write(highScores[i].Score:4, '00 ', highScores[i].Name);
86 | END;
87 | IF lastScore <> -1 THEN BEGIN
88 | GotoXY(40, 22);
89 | Write('Last Score: ',lastScore,'00');
90 | END;
91 | GotoXY(25, 22);
92 |
93 | { randomly prompt the user to get a move on }
94 | insult := FALSE;
95 | msecs := 0;
96 | REPEAT
97 | Delay(1);
98 | msecs := Succ(msecs);
99 | IF msecs >= 1000 THEN BEGIN
100 | msecs := 0;
101 | IF insults THEN BEGIN
102 | IF insult THEN BEGIN
103 | GotoXY(1, 24);
104 | ClrEol;
105 | insult := FALSE;
106 | GotoXY(25, 22);
107 | END ELSE BEGIN
108 | i := Random(10);
109 | IF i > 7 THEN BEGIN
110 | insult := TRUE;
111 | GotoXY(1, 24);
112 | IF i = 8 THEN
113 | Write('You eat quiche!')
114 | ELSE
115 | Write('Come on, we don''t have all day!');
116 | GotoXY(25, 22);
117 | END;
118 | END;
119 | END;
120 | END;
121 |
122 | ch := #0;
123 | IF KeyPressed THEN BEGIN
124 | Read(Kbd, ch);
125 | ch := UpCase(ch);
126 | IF ch = 'L' THEN BEGIN { change playing speed }
127 | playSpeed := SUCC(playSpeed MOD NumPlaySpeeds);
128 | GotoXY(52, 11); Write(playSpeed);
129 | GotoXY(25, 22);
130 | END ELSE IF ch = 'I' THEN
131 | Instructions;
132 | END;
133 | UNTIL ch IN ['P','C','I','E'];
134 | UNTIL ch in ['P', 'C', 'E'];
135 | IF ch = 'E' THEN BEGIN
136 | Write('Exiting...');
137 | GotoXY(1, 24);
138 | ClrEOL;
139 | GotoXY(1, 23);
140 | Halt;
141 | END ELSE IF ch = 'C' THEN BEGIN { run configuration program }
142 | GotoXY(1, 23);
143 | ConfigureLadder;
144 | END;
145 | END;
146 |
147 |
148 | {
149 | Read the LADDER.DAT file. This is the same file used in the original
150 | game. We don't use the cursor control stuff (that's handled by Turbo
151 | Pascal, but do use the control keys, flags and high scores.
152 |
153 | I'm sure this code could be better, but it does the job.
154 | }
155 | PROCEDURE ReadDataFile;
156 | VAR
157 | dataFile,configPgm : FILE;
158 | i, j : INTEGER;
159 | BEGIN
160 | {$I-}
161 | Assign(dataFile, DataFileName);
162 | Reset(dataFile);
163 | IF IOresult <> 0 THEN BEGIN
164 | ConfigureLadder;
165 | END;
166 | BlockRead(dataFile, dataFileContents, SizeOf(dataFileContents) DIV 128);
167 | IF IOresult <> 0 THEN BEGIN
168 | WriteLN('Ladder not configred');
169 | WriteLN;
170 | ConfigureLadder;
171 | END;
172 | WITH dataFileContents DO BEGIN
173 | sound := Flags[0] = 'Y';
174 | insults := Flags[1] = 'Y';
175 | downKey := Keys[0];
176 | leftKey := Keys[1];
177 | rightKey := Keys[2];
178 | upKey := Keys[3];
179 | FOR i := 1 TO NumHighScores DO BEGIN
180 | highScores[i].Name[0] := CHAR(Highs[i][0]);
181 | IF Highs[i][0] = 0 THEN
182 | highScores[i].Score := 0
183 | ELSE
184 | highScores[i].Score := Highs[i][1] OR (Highs[i][2] SHL 8);
185 | FOR j := 1 TO Highs[i][0] DO
186 | highScores[i].Name[j] := CHAR(Highs[i][j + 2]);
187 | END;
188 | END;
189 | Close(dataFile);
190 | {$I+}
191 | END;
192 |
193 | {
194 | Update the high scores in LADDER.DAT. See the comments in
195 | ReadDataFile.
196 | }
197 | PROCEDURE WriteDataFile;
198 | VAR
199 | dataFile : FILE;
200 | i, j : INTEGER;
201 | BEGIN
202 | {$I-}
203 | Assign(dataFile, DataFileName);
204 | Reset(dataFile);
205 | IF IOresult <> 0 THEN BEGIN
206 | WriteLN('Reset failed on LADDER.DAT');
207 | Halt;
208 | END;
209 | WITH dataFileContents DO BEGIN
210 | FOR i := 1 TO NumHighScores DO BEGIN
211 | Highs[i][0] := Length(highScores[i].Name);
212 | Highs[i][1] := Lo(highScores[i].Score);
213 | Highs[i][2] := Hi(highScores[i].Score);
214 | FOR j := 1 TO Highs[i][0] DO
215 | Highs[i][j + 2] := ORD(highScores[i].Name[j]);
216 | END;
217 | BlockWrite(dataFile, dataFileContents, SizeOf(dataFileContents) DIV 128);
218 | IF IOresult <> 0 THEN BEGIN
219 | WriteLN('BlockWrite failed on LADDER.DAT');
220 | Halt;
221 | END;
222 | END;
223 | Close(dataFile);
224 | {$I+}
225 | END;
226 |
227 | {
228 | kill the lad off in a horrible death of mixed up characters.
229 | }
230 | FUNCTION LadDeath : BOOLEAN;
231 | CONST
232 | NumSymbols = 11;
233 | symbols : ARRAY[1..NumSymbols] OF CHAR = ('p', 'b', 'd', 'q', 'p', 'b', 'd', 'q', '-', '-', '_');
234 | VAR
235 | i, j : INTEGER;
236 | name: STRING[DataFileNameLength];
237 | ch : CHAR;
238 | BEGIN
239 | FOR i := 1 TO NumSymbols DO BEGIN
240 | Beep;
241 | GotoXY(lad.X, lad.Y); Write(symbols[i]);
242 | Delay(150);
243 | END;
244 | m.LadsRemaining := Pred(m.LadsRemaining);
245 | GotoXY(8, 21); Write(m.ladsRemaining : 2);
246 | LadDeath := m.LadsRemaining > 0;
247 | IF m.LadsRemaining <= 0 THEN BEGIN
248 | FOR i := 1 TO NumHighScores DO BEGIN
249 | WriteLN(highScores[i].Score);
250 | IF m.Score >= highScores[i].Score THEN BEGIN
251 | FOR j := NumHighScores - 1 DOWNTO i DO BEGIN
252 | highScores[j + 1] := highScores[j];
253 | END;
254 | ClrScr;
255 | GotoXY(10, 7);
256 | FOR j := 1 TO 7 DO
257 | Write('YAHOO! ');
258 | WriteLN;
259 | WriteLN;
260 | CASE levelCycle OF
261 | 1 : WriteLN('You really don''t deserve this but...');
262 | 2 : WriteLN('Not bad for a young Lad');
263 | 3 : WriteLN('Amazing! You rate!!');
264 | 4 : WriteLN('Looks like we have a Lad-Der here');
265 | 5 : WriteLN('Yeah! Now you are a Lad-Wiz!');
266 | 6 : WriteLN('Wow! You are now a Lad-Guru!');
267 | ELSE WriteLN('You are a true Lad-Master!!!');
268 | END;
269 | WriteLN;
270 | While KeyPressed DO
271 | Read(Kbd, ch);
272 | Write('Enter your name: ');
273 | CursOn;
274 | Read(name);
275 | CursOff;
276 | GotoXY(1, 17);
277 | Write('Updating high scores...');
278 | highScores[i].Score := m.Score;
279 | highScores[i].Name := name;
280 | WriteDataFile;
281 | EXIT;
282 | END;
283 | END;
284 | END;
285 | END;
286 |
287 | PROCEDURE DrawMap;
288 | VAR
289 | x, y : INTEGER;
290 | ch : CHAR;
291 | BEGIN
292 | FOR y := 1 TO LevelRows DO BEGIN
293 | GotoXY(1, y);
294 | FOR x := 1 TO LevelCols DO
295 | Write(m.Field[y][x]);
296 | END;
297 | { Draw the lad at rest }
298 | GotoXY(lad.X, lad.Y); Write('g');
299 | { Initialize the entire status line }
300 | GotoXY(1, 21);
301 | Write('Lads ',m.LadsRemaining : 2,
302 | ' Level ', displayLevel : 2,
303 | ' Score ', m.Score : 5, '00',
304 | ' Bonus time ', m.RemainingBonusTime : 2, '00');
305 | GotoXY(1, 23); Write('Get ready!');
306 | Delay(1000);
307 | WHILE KeyPressed DO
308 | Read(Kbd, ch);
309 | GotoXY(1, 23); Write(' ');
310 | END;
311 |
312 | {
313 | Adjusts the score according to some event.
314 | }
315 | PROCEDURE UpdateScore(scoreEvent : ScoreType);
316 | BEGIN
317 | CASE scoreEvent OF
318 |
319 | ScoreStatue: BEGIN
320 | m.Score := m.Score + m.RemainingBonusTime;
321 | Beep;
322 | END;
323 |
324 | ScoreReset: m.Score := 0;
325 |
326 | ScoreRock: BEGIN
327 | m.Score := m.Score + 2;
328 | Beep;
329 | END;
330 |
331 | ScoreMoney: BEGIN
332 | WHILE m.RemainingBonusTime > 0 DO BEGIN
333 | GotoXY(1, 23); Write('Hooka!'); Beep; Delay(100);
334 | GotoXY(1, 23); Write(' '); Delay(100);
335 | m.Score := Succ(m.Score);
336 | m.RemainingBonusTime := Pred(m.RemainingBonusTime);
337 | GotoXY(36, 21); Write(m.Score : 5);
338 | GotoXY(74, 21); Write(m.RemainingBonusTime : 2);
339 | END;
340 | END;
341 | END;
342 | { give a new lad if over 10,000 points }
343 | IF m.Score >= nextNewLad THEN BEGIN
344 | m.ladsRemaining := Succ(m.ladsRemaining);
345 | nextNewLad := nextNewLad + 100;
346 | GotoXY(8, 21); Write(m.ladsRemaining : 2);
347 | END;
348 | GotoXY(36, 21);
349 | Write(m.Score : 5);
350 | END;
351 |
352 | {
353 | Check to see if the Lad has collided with, or jumped over a rock.
354 | }
355 | FUNCTION Collision(rockPtr : RockPointerType) : BOOLEAN;
356 | BEGIN
357 | Collision := FALSE;
358 | IF lad.X = rockPtr^.X THEN BEGIN
359 | IF lad.Y = rockPtr^.Y THEN BEGIN
360 | Collision := TRUE;
361 | END ELSE IF (lad.Y = rockPtr^.Y - 1) AND
362 | (m.Field[lad.Y + 1][lad.X] = ' ') THEN BEGIN
363 | { score for jumping rocks }
364 | UpdateScore(ScoreRock);
365 | END ELSE IF (lad.Y = rockPtr^.Y - 2) THEN
366 | IF (m.Field[lad.Y + 1][lad.X] = ' ') AND (m.Field[lad.Y + 2][lad.X] = ' ') THEN BEGIN
367 | { score for jumping rocks }
368 | UpdateScore(ScoreRock);
369 | END;
370 | END;
371 | END;
372 |
373 | {
374 | Set each rock up in a random dispenser.
375 | }
376 | PROCEDURE DisperseRocks;
377 | VAR
378 | rockPtr : RockPointerType;
379 | dispenserPtr : DispenserPointerType;
380 | i : INTEGER;
381 | BEGIN
382 | rockPtr := m.Rocks;
383 | WHILE rockPtr <> NIL DO BEGIN
384 | dispenserPtr := dispensers;
385 | IF numDispensers > 1 THEN
386 | FOR i := 1 TO Random(numDispensers) DO
387 | dispenserPtr := dispenserPtr^.Next;
388 | InitActor(rockPtr^, AROCK, dispenserPtr^.xy);
389 | rockPtr := rockPtr^.Next;
390 | END;
391 | m.AnyRocksPending := TRUE;
392 | END;
393 |
394 |
--------------------------------------------------------------------------------
/src/ladicons.pas:
--------------------------------------------------------------------------------
1 | { Initialized constants for Ladder }
2 |
3 | CONST
4 | {
5 | p - The place where the lad starts.
6 | V - Der Dispenser. Der Rocks roll out of it to squash you flat.
7 | * - Der Eaters. They eat the Der Rocks but oddly do not harm you in the slightest
8 | = - Floor. You walk on it.
9 | H - Ladder. You climb it.
10 | | - Wall. You can't walk through it. You're not a ghost....yet.
11 | . - Rubber Ball. It's very bouncy. This difference is, it bounces you.
12 | $ - Treasure. The lad must get here to finish the level.
13 | & - Gold Statue. Money!Money!Money!Money!Money!
14 | ^ - Fire. Turns you into extra crispy bacon.
15 | - - Disposable Floor. Well, you can walk on it once.
16 | }
17 | levels : ARRAY[1..NumLevels] OF LevelType = (
18 | (
19 | Name : 'Easy Street';
20 | InitialBonusTime : 35;
21 | Rocks : 5;
22 | Layout : (
23 | ' V $ ',
24 | ' H ',
25 | ' H H ',
26 | ' =========H================================================== ',
27 | ' H ',
28 | ' H ',
29 | ' H H H ',
30 | '================H==========H================== ========H=====================',
31 | ' & H H | | ',
32 | ' H Easy Street ',
33 | ' H H ',
34 | ' =========H==========H========= ======================= ',
35 | ' H ',
36 | ' H ',
37 | ' H H ',
38 | '======================== ====================== =========H============== ',
39 | ' H ',
40 | ' H ',
41 | '* p H *',
42 | '==============================================================================='
43 | )
44 | ),
45 | (
46 | Name : 'Long Island';
47 | InitialBonusTime : 45;
48 | Rocks : 8;
49 | Layout : (
50 | ' $ ',
51 | ' & H ',
52 | ' H |V V| H ',
53 | '====H======================= ========================= ====================== ',
54 | ' H ',
55 | ' H ',
56 | ' H & | . . H ',
57 | '========================== ====== =================== ===================H== ',
58 | ' H ',
59 | ' | H ',
60 | ' H | . . H ',
61 | '====H===================== ====== ================ ====================== ',
62 | ' H ',
63 | ' H | ',
64 | ' H | . . H ',
65 | '========================= ======== ============== ==================H== ',
66 | ' H ',
67 | '============== | H ',
68 | ' Long Island | p * | * H ',
69 | '==============================================================================='
70 | )
71 | ),
72 | (
73 | Name : 'Ghost Town';
74 | InitialBonusTime : 35;
75 | Rocks : 5;
76 | Layout : (
77 | ' V V V $ ',
78 | ' $$$ ',
79 | ' p H H $$$$$ H',
80 | '==========H=== =H==============H',
81 | ' H H H',
82 | ' H & H H',
83 | ' ============== ==== = ====== = ==== =====H===== H',
84 | ' G ^^^ ^^^^^ ^^^^ ^^^^ ^^^ ^^^ $',
85 | ' h | ',
86 | ' o | H & | ',
87 | ' s ======================H============================== =========== ',
88 | ' t & H ',
89 | ' H ',
90 | ' | H H H ',
91 | ' T ==================H=================H===================H======= ',
92 | ' o H H ',
93 | ' w H ',
94 | ' n ^ H ',
95 | '* ^^^ H *',
96 | '==============================================================================='
97 | )
98 | ),
99 | (
100 | Name : 'Tunnel Vision';
101 | InitialBonusTime : 36;
102 | Rocks : 5;
103 | Layout : (
104 | ' V V ',
105 | ' ',
106 | ' H H | H ',
107 | '=====H=====--======H========================== ===----====H=========== ',
108 | ' H H |&& H ',
109 | ' H H ================== H ',
110 | ' H H tunnel H H ',
111 | ' H =======---===----=================H= H H ',
112 | ' H | vision H H H ',
113 | ' H =========---& -----============H H H ',
114 | ' H H H | H H ',
115 | ' H H=========----===----================ H ==============',
116 | ' H & H ',
117 | ' H | H ',
118 | '====---==== H | H ',
119 | '| | ================---===---=================== H ',
120 | '| === | H H p ',
121 | '| $ | H ===H=======',
122 | '|* $$$ *| * * * *H *H ',
123 | '==============================================================================='
124 | )
125 | ),
126 | (
127 | Name : 'Point of No Return';
128 | InitialBonusTime : 35;
129 | Rocks : 7;
130 | Layout : (
131 | ' $ ',
132 | ' H V ',
133 | ' H ',
134 | ' HHHHHHHHHHHHH .HHHHHHHHHHHHHH H p ',
135 | ' & V H ==H==========',
136 | ' H H ',
137 | ' H H . H ',
138 | '===H==============-----------============H==== H ',
139 | ' H H H ',
140 | ' H =====H============== ',
141 | ' H H H ',
142 | ' H &..^^^.....^..^ . ^^ H==--------- H ',
143 | ' H ============================H & H H ',
144 | ' H === === === H ---------=================H======',
145 | ' H H H ',
146 | ' H & H & H ',
147 | ' ==========-------------------------=======----------=================== ',
148 | ' ',
149 | '^^^* ^^^^^^^^^^^^^^^^^^^^^^^^^* *^^^^^^^^^^*Point of No Return*^^^^',
150 | '==============================================================================='
151 | )
152 | ),
153 | (
154 | Name : 'Bug City';
155 | InitialBonusTime : 37;
156 | Rocks : 6;
157 | Layout : (
158 | ' Bug City HHHHHHHH V ',
159 | ' HHH HHH ',
160 | ' H >mmmmmmmm ',
161 | ' H=============== ==================== H ',
162 | ' H |===== \ / V =====H==========',
163 | ' H \/ H ',
164 | ' H | $ H ',
165 | ' H H | H H ',
166 | ' H ====H======= p |&H H H ',
167 | ' H H ======================H ====== ',
168 | ' H H &| H H ',
169 | ' H H &| H H }{ =====H==== ',
170 | '===H===& H =====================H H H ',
171 | ' H H H H ',
172 | ' H H & H ',
173 | ' ======H=== ======= H <> & H ',
174 | ' H========== ===== = ============',
175 | ' }i{ H ',
176 | '* H *',
177 | '==============================================================================='
178 | )
179 | ),
180 | (
181 | Name : 'GangLand';
182 | InitialBonusTime : 32;
183 | Rocks : 6;
184 | Layout : (
185 | ' =Gang Land= V ',
186 | ' == _ == . ',
187 | ' p H | [] |_| | & . H ',
188 | '===========H | |_| | H === ===================H ',
189 | ' V H ============= H====== H ',
190 | ' H H & H ',
191 | ' H H | | H ',
192 | ' H H ^^^&&^^^ & ^ ^^^ H H | =============H ',
193 | ' H======H =======================H===========H===== & H ',
194 | ' H H H | &&& H ',
195 | ' H H H | &&&&& H ',
196 | ' H H H | =============H ',
197 | ' =====------================= H | $ $ ',
198 | ' | H | $$$ $$$ ',
199 | '====------=== | H | $$$$$ $$$$$ ',
200 | ' | = | ============= ============ ',
201 | ' | $ ^ & ',
202 | ' |^^^^^^^^^^^^^^ $ ^ ====== ',
203 | '* . & ^ H*^ ^ ^ ^^^^^^^^^^^^',
204 | '==============================================================================='
205 | )
206 | )
207 | );
208 |
209 | {
210 | A moving jump is UR/UR/R/R/DR/DR
211 | or UL/UL/L/L/DL/DL
212 | A standing jump is U/U/-/D/D
213 |
214 | ====================
215 | ----234-----23------
216 | ---1---5----14------
217 | --0-----6---05------
218 | ====================
219 | }
220 | jumpPaths : Array[JUMPRIGHT..JUMPLEFT] OF ActionArrayType = (
221 | (UPRIGHT, UPRIGHT, RIGHT, RIGHT, DOWNRIGHT, DOWNRIGHT),
222 | (UP, UP, STOPPED, DOWN, DOWN, ACTIONEND),
223 | (UPLEFT, UPLEFT, LEFT, LEFT, DOWNLEFT, DOWNLEFT)
224 | );
225 |
226 | dirs : ARRAY[STOPPED..JUMPLEFT] OF XYtype = (
227 | (x: 0; y: 0), { STOPPED }
228 | (x: 0; y:-1), { UP }
229 | (x: 1; y:-1), { UPRIGHT }
230 | (x: 1; y: 0), { RIGHT }
231 | (x: 1; y: 1), { DOWNRIGHT }
232 | (x: 0; y: 1), { DOWN }
233 | (x:-1; y: 1), { DOWNLEFT }
234 | (x:-1; y: 0), { LEFT }
235 | (x:-1; y:-1), { UPLEFT }
236 | (x: 0; y: 1), { FALLING }
237 | (x: 0; y: 0), { JUMP }
238 | (x: 0; y: 0), { JUMPRIGHT }
239 | (x: 0; y: 0), { JUMPUP }
240 | (x: 0; y: 0) { JUMPLEFT }
241 | );
242 |
243 | ReadmsWait : ARRAY [1..NumPlaySpeeds] OF INTEGER = (100, 50, 25, 13, 7);
244 |
245 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------