-
Notifications
You must be signed in to change notification settings - Fork 2
/
RESULTS.PAS
125 lines (101 loc) · 2.95 KB
/
RESULTS.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
unit Results;
interface
procedure DoResults;
implementation
uses GDGfx, GDKeybrd, GDTimer, GDEvents, Assets, Draw, Entities, Shared;
procedure DrawResults;
var
uiFrame : ^UIFrameBitmaps;
playerTile, fruitTile : word;
c : color;
s : string[3];
player1win, player2win : boolean;
begin
Cls(0);
BlitSpritef(98, 10, titleResults);
UseFont(@fnt);
if player1.score > player2.score then begin
DrawString(120, 60, 15, 'Player 1 Wins!');
player1win := true;
player2win := false;
end else if player2.score > player1.score then begin
DrawString(120, 60, 15, 'Player 2 Wins!');
player1win := false;
player2win := true;
end else begin
DrawString(130, 60, 16, 'It''s A Tie!');
player1win := false;
player2win := false;
end;
if player1Selection = Tomato then begin
uiFrame := @uiTomatoFrame;
playerTile := PLAYER_TOMATO_TILE_START;
fruitTile := FRUIT_TOMATO_TILE_START;
c := TOMATO_TEXT_COLOR;
end else begin
uiFrame := @uiGrapesFrame;
playerTile := PLAYER_GRAPES_TILE_START;
fruitTile := FRUIT_GRAPES_TILE_START;
c := GRAPES_TEXT_COLOR;
end;
if player1win then
inc(playerTile, 16)
else if player2win then
inc(playerTile, 17);
UseFont(@fnt);
DrawUIFrame(60, 90, 64, 64, uiFrame^);
DrawString(68, 98, 15, 'Player 1');
BlitSpritef(72, 122, sprites[playerTile]);
BlitSpritef(72+16+8, 122, sprites[fruitTile]);
UseFont(@chunkyFnt);
Str(player1.score:3, s);
DrawStringf(72+16+8, 132, c, s);
if player2Selection = Tomato then begin
uiFrame := @uiTomatoFrame;
playerTile := PLAYER_TOMATO_TILE_START;
fruitTile := FRUIT_TOMATO_TILE_START;
c := TOMATO_TEXT_COLOR;
end else begin
uiFrame := @uiGrapesFrame;
playerTile := PLAYER_GRAPES_TILE_START;
fruitTile := FRUIT_GRAPES_TILE_START;
c := GRAPES_TEXT_COLOR;
end;
if player2win then
inc(playerTile, 16)
else if player1win then
inc(playerTile, 17);
UseFont(@fnt);
DrawUIFrame(196, 90, 64, 64, uiFrame^);
DrawString(204, 98, 15, 'Player 2');
BlitSpritef(208, 122, sprites[playerTile]);
BlitSpritef(208+16+8, 122, sprites[fruitTile]);
UseFont(@chunkyFnt);
Str(player2.score:3, s);
DrawStringf(208+16+8, 132, c, s);
WaitForVsync;
Flip(BACKBUFFER_LAYER);
end;
procedure DoResults;
var
quit : boolean;
event : PInputEvent;
begin
UseLayer(BACKBUFFER_LAYER);
DrawResults;
FadeIn;
InitEvents;
quit := false;
while not quit do begin
while not IsEventsEmpty do begin
event := PollEvents;
if IsKeyReleasedEvent(event, KEY_ESC) then quit := true;
if IsKeyReleasedEvent(event, KEY_ENTER) then quit := true;
end;
DrawResults;
end;
CloseEvents;
FadeOut;
currentGameState := StateMainMenu;
end;
end.