Merge lp:~flozz/hangman8086/scores into lp:hangman8086
- scores
- Merge into trunk
Proposed by
Fabien LOISON
Status: | Merged |
---|---|
Approved by: | Vincent PEYROUSE (GodezInc) |
Approved revision: | 14 |
Merged at revision: | 11 |
Proposed branch: | lp:~flozz/hangman8086/scores |
Merge into: | lp:hangman8086 |
Diff against target: |
467 lines (+381/-3) 7 files modified
README (+1/-1) game.asm (+2/-1) main.asm (+2/-0) mainmenu.asm (+7/-0) scores.asm (+360/-0) singlepl.asm (+7/-1) twopl.asm (+2/-0) |
To merge this branch: | bzr merge lp:~flozz/hangman8086/scores |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent PEYROUSE (GodezInc) | Pending | ||
Review via email: mp+65103@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' |
2 | --- README 2011-05-16 14:31:51 +0000 |
3 | +++ README 2011-06-18 21:26:31 +0000 |
4 | @@ -39,6 +39,6 @@ |
5 | WINDOWS: |
6 | |
7 | Open the main.asm file with emu8086.exe <http://www.emu8086.com/> |
8 | - and clique on the build button on the GUI. |
9 | + and click on the build button on the GUI. |
10 | |
11 | |
12 | |
13 | === modified file 'game.asm' |
14 | --- game.asm 2011-06-18 11:36:33 +0000 |
15 | +++ game.asm 2011-06-18 21:26:31 +0000 |
16 | @@ -42,6 +42,7 @@ |
17 | ;; _print_gword() -- Prints the guessed word (e.g. H _ _ _ _ _ N). |
18 | ;; _print_tried_letters -- Prints the letters that the player have already |
19 | ;; tried (e.g. A U I O W). |
20 | +;; _print_score() -- Print the score (in competition mode). |
21 | ;; _game_anima() -- Displays an animation when the player loose |
22 | ;; or win. |
23 | ;; |
24 | @@ -478,7 +479,7 @@ |
25 | |
26 | |
27 | ;========================================================= _print_score() ==== |
28 | -;; Print the score in competition mode). |
29 | +;; Print the score (in competition mode). |
30 | |
31 | ;; Usage: |
32 | ;; call _print_tried_letters |
33 | |
34 | === modified file 'main.asm' |
35 | --- main.asm 2011-06-18 16:04:12 +0000 |
36 | +++ main.asm 2011-06-18 21:26:31 +0000 |
37 | @@ -69,6 +69,8 @@ |
38 | include "twopl.asm" ;Contains the two player mode. |
39 | include "options.asm" ;Contains the options menu. |
40 | include "modesel.asm" ;Contains the mode selection menu. |
41 | +include "scores.asm" ;Contains the functions for displaying and managing |
42 | + ;scores. |
43 | |
44 | ;RESOURCE |
45 | include "asciiart.res" ;Contains the ASCII art of the game. |
46 | |
47 | === modified file 'mainmenu.asm' |
48 | --- mainmenu.asm 2011-06-17 12:39:56 +0000 |
49 | +++ mainmenu.asm 2011-06-18 21:26:31 +0000 |
50 | @@ -147,6 +147,13 @@ |
51 | jmp _main_menu |
52 | main_menu_option_end: |
53 | |
54 | + ;Scores |
55 | + cmp main_menu_selected, MAIN_MENU_SCORES |
56 | + jne main_menu_scores_end |
57 | + call _scores |
58 | + jmp _main_menu |
59 | + main_menu_scores_end: |
60 | + |
61 | ;Quit |
62 | cmp main_menu_selected, MAIN_MENU_QUIT |
63 | je main_menu_end |
64 | |
65 | === added file 'scores.asm' |
66 | --- scores.asm 1970-01-01 00:00:00 +0000 |
67 | +++ scores.asm 2011-06-18 21:26:31 +0000 |
68 | @@ -0,0 +1,360 @@ |
69 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
70 | +;; __ __ _______ __ _ _______ __ __ _______ __ _ ;; |
71 | +;; | | | || _ || | | || || |_| || _ || | | | ;; |
72 | +;; | |_| || |_| || |_| || ___|| || |_| || |_| | ;; |
73 | +;; | || || || | __ | || || | ;; |
74 | +;; | || || _ || || || || || _ | ;; |
75 | +;; | _ || _ || | | || |_| || ||_|| || _ || | | | ;; |
76 | +;; |__| |__||__| |__||_| |__||_______||_| |_||__| |__||_| |__| ;; |
77 | +;; ;; |
78 | +;; ;; |
79 | +;; HANGMAN - An implementation of the Hang Man game in assembly (Emu8086) ;; |
80 | +;; ;; |
81 | +;; Copyright (C) 2011 Fabien LOISON ;; |
82 | +;; Copyright (C) 2011 Mathilde BOUTIGNY ;; |
83 | +;; Copyright (C) 2011 Vincent PEYROUSE ;; |
84 | +;; Copyright (C) 2011 Germain CARRÉ ;; |
85 | +;; Copyright (C) 2011 Matthis FRENAY ;; |
86 | +;; ;; |
87 | +;; HangMan is free software: you can redistribute it and/or modify ;; |
88 | +;; it under the terms of the GNU General Public License as published by ;; |
89 | +;; the Free Software Foundation, either version 3 of the License, or ;; |
90 | +;; (at your option) any later version. ;; |
91 | +;; ;; |
92 | +;; This program is distributed in the hope that it will be useful, ;; |
93 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; |
94 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; |
95 | +;; GNU General Public License for more details. ;; |
96 | +;; ;; |
97 | +;; You should have received a copy of the GNU General Public License ;; |
98 | +;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; |
99 | +;; ;; |
100 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
101 | + |
102 | + |
103 | +;; |
104 | +;; Contains the functions for displaying and managing scores. |
105 | +;; |
106 | +;; Index: |
107 | +;; _scores -- Displays the best scores. |
108 | +;; _new_sp_score(NSPS_NAME, NSPS_SCORE) -- Insert the new score if |
109 | +;; necessary (single PLAYER |
110 | +;; mode). |
111 | +;; |
112 | + |
113 | + |
114 | + |
115 | +SP_SCORE_1N db "FLOZZ " |
116 | +SP_SCORE_1S dw 1000 |
117 | + |
118 | +SP_SCORE_2N db "WILBER " |
119 | +SP_SCORE_2S dw 100 |
120 | + |
121 | +SP_SCORE_3N db "THIERRY " |
122 | +SP_SCORE_3S dw 50 |
123 | + |
124 | + |
125 | +TP_SCORE_1N db "TOMATE " |
126 | +TP_SCORE_1S dw 42 |
127 | + |
128 | +TP_SCORE_2N db "WILBER " |
129 | +TP_SCORE_2S dw 20 |
130 | + |
131 | +TP_SCORE_3N db "THIERRY " |
132 | +TP_SCORE_3S dw 10 |
133 | + |
134 | + |
135 | + |
136 | +;============================================================== _scores() ==== |
137 | +;; Contains the functions for displaying and managing scores. |
138 | + |
139 | +;; Usage: |
140 | +;; call _scores |
141 | + |
142 | + |
143 | +_scores: |
144 | + |
145 | +;Backup registers |
146 | +push ax |
147 | +push bx |
148 | +push cx |
149 | +push dx |
150 | + |
151 | +;Draw the UI |
152 | +call _draw_ui |
153 | +mov HELP_STR, offset scores_help |
154 | +call _print_help |
155 | + |
156 | +;SINGLE PLAYER |
157 | + mov POS_X, 15 |
158 | + mov POS_Y, header_height + 6 |
159 | + call _move_cursor |
160 | + |
161 | + ;TITLE |
162 | + mov ah, 0x09 |
163 | + mov dx, offset scores_sp_title |
164 | + int 0x21 |
165 | + |
166 | + add POS_Y, 2 |
167 | + call _move_cursor |
168 | + |
169 | + ;ITEM 1 |
170 | + mov MEMCPY_SRC, offset SP_SCORE_1N |
171 | + mov MEMCPY_DEST, offset scores_disp_tpl |
172 | + add MEMCPY_DEST, 3 |
173 | + mov MEMCPY_LEN, 8 |
174 | + call _memcpy |
175 | + ;; |
176 | + mov ax, SP_SCORE_1S |
177 | + mov I2S_INT, ax |
178 | + call _inttostr |
179 | + mov MEMCPY_SRC, offset I2S_STR |
180 | + add MEMCPY_DEST, 9 |
181 | + mov MEMCPY_LEN, 4 |
182 | + call _memcpy |
183 | + |
184 | + mov ah, 0x09 |
185 | + mov dx, offset scores_disp_tpl |
186 | + int 0x21 |
187 | + |
188 | + inc POS_Y |
189 | + call _move_cursor |
190 | + |
191 | + ;ITEM 2 |
192 | + mov MEMCPY_SRC, offset SP_SCORE_2N |
193 | + mov MEMCPY_DEST, offset scores_disp_tpl |
194 | + add MEMCPY_DEST, 3 |
195 | + mov MEMCPY_LEN, 8 |
196 | + call _memcpy |
197 | + ;; |
198 | + mov ax, SP_SCORE_2S |
199 | + mov I2S_INT, ax |
200 | + call _inttostr |
201 | + mov MEMCPY_SRC, offset I2S_STR |
202 | + add MEMCPY_DEST, 9 |
203 | + mov MEMCPY_LEN, 4 |
204 | + call _memcpy |
205 | + |
206 | + mov ah, 0x09 |
207 | + mov dx, offset scores_disp_tpl |
208 | + int 0x21 |
209 | + |
210 | + inc POS_Y |
211 | + call _move_cursor |
212 | + |
213 | + ;ITEM 3 |
214 | + mov MEMCPY_SRC, offset SP_SCORE_3N |
215 | + mov MEMCPY_DEST, offset scores_disp_tpl |
216 | + add MEMCPY_DEST, 3 |
217 | + mov MEMCPY_LEN, 8 |
218 | + call _memcpy |
219 | + ;; |
220 | + mov ax, SP_SCORE_3S |
221 | + mov I2S_INT, ax |
222 | + call _inttostr |
223 | + mov MEMCPY_SRC, offset I2S_STR |
224 | + add MEMCPY_DEST, 9 |
225 | + mov MEMCPY_LEN, 4 |
226 | + call _memcpy |
227 | + |
228 | + mov ah, 0x09 |
229 | + mov dx, offset scores_disp_tpl |
230 | + int 0x21 |
231 | + |
232 | +;TWO PLAYER |
233 | + mov POS_X, COLS - 15 - 19 |
234 | + mov POS_Y, header_height + 6 |
235 | + call _move_cursor |
236 | + |
237 | + ;TITLE |
238 | + mov ah, 0x09 |
239 | + mov dx, offset scores_tp_title |
240 | + int 0x21 |
241 | + |
242 | + add POS_Y, 2 |
243 | + call _move_cursor |
244 | + |
245 | + ;ITEM 1 |
246 | + mov MEMCPY_SRC, offset TP_SCORE_1N |
247 | + mov MEMCPY_DEST, offset scores_disp_tpl |
248 | + add MEMCPY_DEST, 3 |
249 | + mov MEMCPY_LEN, 8 |
250 | + call _memcpy |
251 | + ;; |
252 | + mov ax, TP_SCORE_1S |
253 | + mov I2S_INT, ax |
254 | + call _inttostr |
255 | + mov MEMCPY_SRC, offset I2S_STR |
256 | + add MEMCPY_DEST, 9 |
257 | + mov MEMCPY_LEN, 4 |
258 | + call _memcpy |
259 | + |
260 | + mov ah, 0x09 |
261 | + mov dx, offset scores_disp_tpl |
262 | + int 0x21 |
263 | + |
264 | + inc POS_Y |
265 | + call _move_cursor |
266 | + |
267 | + ;ITEM 2 |
268 | + mov MEMCPY_SRC, offset TP_SCORE_2N |
269 | + mov MEMCPY_DEST, offset scores_disp_tpl |
270 | + add MEMCPY_DEST, 3 |
271 | + mov MEMCPY_LEN, 8 |
272 | + call _memcpy |
273 | + ;; |
274 | + mov ax, TP_SCORE_2S |
275 | + mov I2S_INT, ax |
276 | + call _inttostr |
277 | + mov MEMCPY_SRC, offset I2S_STR |
278 | + add MEMCPY_DEST, 9 |
279 | + mov MEMCPY_LEN, 4 |
280 | + call _memcpy |
281 | + |
282 | + mov ah, 0x09 |
283 | + mov dx, offset scores_disp_tpl |
284 | + int 0x21 |
285 | + |
286 | + inc POS_Y |
287 | + call _move_cursor |
288 | + |
289 | + ;ITEM 3 |
290 | + mov MEMCPY_SRC, offset TP_SCORE_3N |
291 | + mov MEMCPY_DEST, offset scores_disp_tpl |
292 | + add MEMCPY_DEST, 3 |
293 | + mov MEMCPY_LEN, 8 |
294 | + call _memcpy |
295 | + ;; |
296 | + mov ax, TP_SCORE_3S |
297 | + mov I2S_INT, ax |
298 | + call _inttostr |
299 | + mov MEMCPY_SRC, offset I2S_STR |
300 | + add MEMCPY_DEST, 9 |
301 | + mov MEMCPY_LEN, 4 |
302 | + call _memcpy |
303 | + |
304 | + mov ah, 0x09 |
305 | + mov dx, offset scores_disp_tpl |
306 | + int 0x21 |
307 | + |
308 | +;Wait |
309 | +mov ax, 0x0000 |
310 | +int 0x16 |
311 | + |
312 | +;Restore registers |
313 | +pop dx |
314 | +pop cx |
315 | +pop bx |
316 | +pop ax |
317 | + |
318 | +ret |
319 | + |
320 | + |
321 | +;Datas |
322 | +scores_help db "Press any key$" |
323 | + |
324 | +scores_sp_title db "-- SINGLE PLAYER --$" |
325 | +scores_tp_title db "--- TWO PLAYERS ---$" |
326 | +scores_disp_tpl db " > <PLAYER> <SC>$" |
327 | + |
328 | + |
329 | + |
330 | +;=================================== _new_sp_score(NSPS_NAME, NSPS_SCORE) ==== |
331 | +;; Insert the new score if necessary (single player mode). |
332 | + |
333 | +;; Usage: |
334 | +;; mov NSPS_NAME, offset <playername> |
335 | +;; mov NSPS_SCORE, <score> |
336 | +;; call _scores |
337 | + |
338 | +;; Args: |
339 | +NSPS_NAME dw 0 ;Address of the player name |
340 | +NSPS_SCORE dw 0 ;The score |
341 | + |
342 | + |
343 | +_new_sp_score: |
344 | + |
345 | +;Backup registers |
346 | +push ax |
347 | +push bx |
348 | +push cx |
349 | +push dx |
350 | + |
351 | +;Check if the score is better than the best score |
352 | + mov ax, NSPS_SCORE |
353 | + cmp SP_SCORE_1S, ax |
354 | + jge nsps_1s_end |
355 | + |
356 | + mov ax, SP_SCORE_2S |
357 | + mov SP_SCORE_3S, ax |
358 | + mov MEMCPY_SRC, offset SP_SCORE_2N |
359 | + mov MEMCPY_DEST, offset SP_SCORE_3N |
360 | + mov MEMCPY_LEN, 8 |
361 | + call _memcpy |
362 | + |
363 | + mov ax, SP_SCORE_1S |
364 | + mov SP_SCORE_2S, ax |
365 | + mov MEMCPY_SRC, offset SP_SCORE_1N |
366 | + mov MEMCPY_DEST, offset SP_SCORE_2N |
367 | + mov MEMCPY_LEN, 8 |
368 | + call _memcpy |
369 | + |
370 | + mov ax, NSPS_SCORE |
371 | + mov SP_SCORE_1S, ax |
372 | + mov ax, NSPS_NAME |
373 | + mov MEMCPY_SRC, ax |
374 | + mov MEMCPY_DEST, offset SP_SCORE_1N |
375 | + mov MEMCPY_LEN, 8 |
376 | + call _memcpy |
377 | + |
378 | + jmp nsps_end |
379 | + nsps_1s_end: |
380 | + |
381 | +;Check if the score is better than the second score |
382 | + mov ax, NSPS_SCORE |
383 | + cmp SP_SCORE_2S, ax |
384 | + jge nsps_2s_end |
385 | + |
386 | + mov ax, SP_SCORE_2S |
387 | + mov SP_SCORE_3S, ax |
388 | + mov MEMCPY_SRC, offset SP_SCORE_2N |
389 | + mov MEMCPY_DEST, offset SP_SCORE_3N |
390 | + mov MEMCPY_LEN, 8 |
391 | + call _memcpy |
392 | + |
393 | + mov ax, NSPS_SCORE |
394 | + mov SP_SCORE_2S, ax |
395 | + mov ax, NSPS_NAME |
396 | + mov MEMCPY_SRC, ax |
397 | + mov MEMCPY_DEST, offset SP_SCORE_2N |
398 | + mov MEMCPY_LEN, 8 |
399 | + call _memcpy |
400 | + |
401 | + jmp nsps_end |
402 | + nsps_2s_end: |
403 | + |
404 | +;Check if the score is better than the third score |
405 | + mov ax, NSPS_SCORE |
406 | + cmp SP_SCORE_3S, ax |
407 | + jge nsps_end |
408 | + |
409 | + mov ax, NSPS_SCORE |
410 | + mov SP_SCORE_3S, ax |
411 | + mov ax, NSPS_NAME |
412 | + mov MEMCPY_SRC, ax |
413 | + mov MEMCPY_DEST, offset SP_SCORE_3N |
414 | + mov MEMCPY_LEN, 8 |
415 | + call _memcpy |
416 | + |
417 | + |
418 | +nsps_end: |
419 | + |
420 | +;Restore registers |
421 | +pop dx |
422 | +pop cx |
423 | +pop bx |
424 | +pop ax |
425 | + |
426 | +ret |
427 | + |
428 | + |
429 | |
430 | === modified file 'singlepl.asm' |
431 | --- singlepl.asm 2011-06-18 14:23:09 +0000 |
432 | +++ singlepl.asm 2011-06-18 21:26:31 +0000 |
433 | @@ -36,7 +36,8 @@ |
434 | ;; Contains the single player mode. |
435 | ;; |
436 | ;; Index: |
437 | -;; _single_player() -- Play in single player mode. |
438 | +;; _single_player() -- Play in single player mode. |
439 | +;; _sp_gameover() -- Prints the game over screen |
440 | ;; |
441 | |
442 | |
443 | @@ -135,6 +136,11 @@ |
444 | cmp MODE, MODE_COMPETITION |
445 | jnz sp_start |
446 | |
447 | +mov NSPS_NAME, offset PLAYER |
448 | +mov ax, SCORE |
449 | +mov NSPS_SCORE, ax |
450 | +call _new_sp_score |
451 | + |
452 | call _sp_gameover |
453 | |
454 | sp_end: |
455 | |
456 | === modified file 'twopl.asm' |
457 | --- twopl.asm 2011-06-18 16:04:12 +0000 |
458 | +++ twopl.asm 2011-06-18 21:26:31 +0000 |
459 | @@ -57,6 +57,8 @@ |
460 | push cx |
461 | push dx |
462 | |
463 | +mov MODE, MODE_PRACTICE ;FIXME |
464 | + |
465 | ;Ask the first player's name |
466 | |
467 | mov IF_MSG, offset tp_msg_fplname |