Commit 1419de92 authored by bocianu's avatar bocianu

level shown on end, performance improved

parent 399d0728
......@@ -13,7 +13,7 @@ strings_list
dta a(txt_10)
dta a(txt_11)
dta a(txt_12)
; dta a(txt_13)
dta a(txt_13)
; dta a(txt_14)
strings
......@@ -32,6 +32,7 @@ txt_9 dta "game written in MadPascal"
txt_10 dta "special thanks to TeBe and P.H.A.T."
txt_11 dta "Hi-Score:"
txt_13 dta "Level: "
.print "STRINGS SIZE: ", *-strings_list
.print "STRINGS : ", strings_list, "..", *
......@@ -7,11 +7,12 @@ changes:
- bonus fruits - randomly appears in 3 variants
- now each ghost can have different ai level
- score presented on game ending and on hsc matrix
- level selection on title screen
- starting level selection on title screen
- current level shown on gameover screen
- new sound FX
- cheat mode added
- some speed optimizations and improvements
- visual improvements
- some speed optimizations
- minor visual improvements
zmiany:
......@@ -21,6 +22,7 @@ zmiany:
- każdy duszek ma teraz osobne AI,
- wynik prezentowany na zakończenie gry i na matrycy HSC,
- możliwość wyboru startowego poziomu klawiszem SELECT,
- wyświetlanie bieżącego poziomu na ekranie końca gry
- nowe efekty dzwiękowe,
- ukryty 'cheat mode',
- oprymalizacje szybkości,
......
......@@ -60,7 +60,6 @@ var
score: cardinal;
hiscore: cardinal;
liveBonus: word;
food: word;
lives: byte;
dotCount: word;
......@@ -195,6 +194,22 @@ begin
};
end;
procedure UpdateEndLevel;
begin
Str(currentLevel+1, s);
asm {
ldy #1
@ lda adr.s,y
sub #32
sta TXT_RAM+36,y
iny
dec adr.s
bne @-
lda #0
sta TXT_RAM+36,y
};
end;
procedure UpdateLevel;
begin
Str(startingLevel+1, s);
......@@ -364,8 +379,7 @@ begin
case cell of
TILE_DOT: begin
AddScore(10);
Inc(food);
if dotCount>0 then begin
if dotCount<>0 then begin
Dec(dotCount);
if dotCount=0 then msx.Sfx(4, 2, 12);
end;
......@@ -599,6 +613,7 @@ begin
if pillBonus = 300 then g^.reward := TILE_300;
if pillBonus = 400 then g^.reward := TILE_400;
if pillBonus = 500 then g^.reward := TILE_500;
PaintOnBoard(g^.dx, g^.dy, g^.reward);
FillChar(pointer(PMGBASE + 512 + (ghostNumber shl 7)), 128, 0);
end;
......@@ -711,30 +726,32 @@ begin
step:=1;
if gameState = GAME_ESCAPE then step := frame and 1; // slow down by skipin steps in escape mode
if ((g^.dir = DIR_RIGHT) or (g^.dir = DIR_DOWN)) then g^.step := g^.step + step;
if ((g^.dir = DIR_LEFT) or (g^.dir = DIR_UP)) then g^.step := g^.step - step;
if Abs(g^.step) = 8 then begin // moved into new position
if (Abs(shortInt(g^.y-pac.y))<GHOST_DESPAWN_DISTANCE) then g^.despawn := 0
else g^.despawn := g^.despawn + 1;
if g^.despawn = GHOST_DESPAWN_DELAY then DespawnGhost(ghostNumber)
else begin
if g^.step > 0 then g^.step := 1 else g^.step := -1;
if Odd(g^.dir) then begin // horizontal
g^.x := g^.x + g^.step;
if not CanMoveTo(g^.x + g^.step,g^.y) then g^.dir := DIR_NONE; // on turns try to follow pac
end else begin // vertical
g^.y := g^.y + g^.step;
if not CanMoveTo(g^.x,g^.y + g^.step) then g^.dir := DIR_NONE; // on turns try to follow pac
end;
g^.step := 0;
exitMask := GetNeighbours(g^.x, g^.y);
exitCount := exitMask shr 4;
// if more than 3 exits or cannot continue move then take decision
if (exitCount > 2) or (g^.dir = DIR_NONE) then g^.dir := FollowPac(ghostNumber,exitMask);
end;
end;
if step<>0 then begin
if ((g^.dir = DIR_RIGHT) or (g^.dir = DIR_DOWN)) then g^.step := g^.step + step;
if ((g^.dir = DIR_LEFT) or (g^.dir = DIR_UP)) then g^.step := g^.step - step;
if Abs(g^.step) = 8 then begin // moved into new position
if (Abs(shortInt(g^.y-pac.y))<GHOST_DESPAWN_DISTANCE) then g^.despawn := 0
else g^.despawn := g^.despawn + 1;
if g^.despawn = GHOST_DESPAWN_DELAY then DespawnGhost(ghostNumber)
else begin
if g^.step > 0 then g^.step := 1 else g^.step := -1;
if Odd(g^.dir) then begin // horizontal
g^.x := g^.x + g^.step;
if not CanMoveTo(g^.x + g^.step,g^.y) then g^.dir := DIR_NONE; // on turns try to follow pac
end else begin // vertical
g^.y := g^.y + g^.step;
if not CanMoveTo(g^.x,g^.y + g^.step) then g^.dir := DIR_NONE; // on turns try to follow pac
end;
g^.step := 0;
exitMask := GetNeighbours(g^.x, g^.y);
exitCount := exitMask shr 4;
// if more than 3 exits or cannot continue move then take decision
if (exitCount > 2) or (g^.dir = DIR_NONE) then g^.dir := FollowPac(ghostNumber,exitMask);
end;
end;
end;
ghostSpritesheets[ghostNumber] := ghost_sprites[g^.dir];
end;
end;
......@@ -866,6 +883,7 @@ begin
else // vertical
pac.y := pac.y + pac.step; // increment absolute position
pac.step := 0;
CheckBoardAction;
end;
end;
......@@ -1337,7 +1355,6 @@ begin
InitView;
dotCount := dotCount - level.dotLimit;
ClearTxT;
food := 0;
bonusPosPicked := false;
bonusDelay := BONUS_DELAY * 50;
......@@ -1388,12 +1405,15 @@ begin
until (_STRIG0 = 0) or (_CONSOL and 1 = 0) or (count = 40);
Move(pointer(TXT_RAM+$100), pointer(dltop+top), height);
SongStart(SONG_GAME);
CheckBoardAction;
end;
procedure ShowGameOver;
const top = 40;
var count:byte;
begin
Move(strings[13],pointer(TXT_RAM+31),8); // level topbar
UpdateEndLevel;
count:=0;
MoveViewport;
PMG_clear;
......@@ -1506,15 +1526,16 @@ begin
MovePac;
MoveGhosts;
Pause; // wait for VBLI
ShowPac;
ShowGhosts;
CheckIfPacTurnsBack;
if pac.step = 0 then begin // pac enters new field
CheckBoardAction;
CheckIfPacTurns;
end;
Pause; // wait for VBLI
ShowPac;
ShowGhosts;
collider := PacColider; // detect collisions
if collider <> 0 then begin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment