Merge lp:~flozz/hangman8086/options into lp:hangman8086

Proposed by Fabien LOISON
Status: Merged
Approved by: Vincent PEYROUSE (GodezInc)
Approved revision: 10
Merged at revision: 7
Proposed branch: lp:~flozz/hangman8086/options
Merge into: lp:hangman8086
Diff against target: 465 lines (+389/-3)
7 files modified
.bzrignore (+1/-0)
game.asm (+7/-1)
main.asm (+1/-0)
mainmenu.asm (+7/-0)
options.asm (+262/-0)
singlepl.asm (+7/-1)
words.res (+104/-1)
To merge this branch: bzr merge lp:~flozz/hangman8086/options
Reviewer Review Type Date Requested Status
Vincent PEYROUSE (GodezInc) Pending
Review via email: mp+62979@code.launchpad.net

Description of the change

Option menu implemented
With/Without gibbet option added
French word list added (+option)

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 '.bzrignore'
2--- .bzrignore 2011-05-16 14:31:51 +0000
3+++ .bzrignore 2011-05-31 13:06:33 +0000
4@@ -1,3 +1,4 @@
5 *.com*
6 *.sh
7 buildenv
8+dosbox
9
10=== modified file 'game.asm'
11--- game.asm 2011-05-26 14:19:39 +0000
12+++ game.asm 2011-05-31 13:06:33 +0000
13@@ -257,7 +257,13 @@
14 jne game_init_sploop
15
16 ;Init the play_lives to 10 (with gibbet) or 6 (without gibbet)
17-mov play_lives, 10 ;FIXME
18+cmp OPTION_GIBBET, OPTION_GIBBET_ON
19+je game_init_lives_gibbet_on
20+mov play_lives, 6
21+jmp game_init_lives_gibbet_end
22+game_init_lives_gibbet_on:
23+mov play_lives, 10
24+game_init_lives_gibbet_end:
25
26 ;Restore registers
27 pop dx
28
29=== modified file 'main.asm'
30--- main.asm 2011-05-26 14:19:39 +0000
31+++ main.asm 2011-05-31 13:06:33 +0000
32@@ -64,6 +64,7 @@
33 include "stscreen.asm" ;Contains the function that print the startup screen.
34 include "game.asm" ;Contains the game functions.
35 include "singlepl.asm" ;Contains the single player mode.
36+include "options.asm" ;Contains the options menu.
37
38 ;RESOURCE
39 include "asciiart.res" ;Contains the ASCII art of the game.
40
41=== modified file 'mainmenu.asm'
42--- mainmenu.asm 2011-05-26 14:19:39 +0000
43+++ mainmenu.asm 2011-05-31 13:06:33 +0000
44@@ -133,6 +133,13 @@
45 jmp _main_menu
46 main_menu_sp_end:
47
48+ ;Options
49+ cmp main_menu_selected, MAIN_MENU_OPTIONS
50+ jne main_menu_option_end
51+ call _option_menu
52+ jmp _main_menu
53+ main_menu_option_end:
54+
55 ;Quit
56 cmp main_menu_selected, MAIN_MENU_QUIT
57 je main_menu_end
58
59=== added file 'options.asm'
60--- options.asm 1970-01-01 00:00:00 +0000
61+++ options.asm 2011-05-31 13:06:33 +0000
62@@ -0,0 +1,262 @@
63+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
64+;; __ __ _______ __ _ _______ __ __ _______ __ _ ;;
65+;; | | | || _ || | | || || |_| || _ || | | | ;;
66+;; | |_| || |_| || |_| || ___|| || |_| || |_| | ;;
67+;; | || || || | __ | || || | ;;
68+;; | || || _ || || || || || _ | ;;
69+;; | _ || _ || | | || |_| || ||_|| || _ || | | | ;;
70+;; |__| |__||__| |__||_| |__||_______||_| |_||__| |__||_| |__| ;;
71+;; ;;
72+;; ;;
73+;; HANGMAN - An implementation of the Hang Man game in assembly (Emu8086) ;;
74+;; ;;
75+;; Copyright (C) 2011 Fabien LOISON ;;
76+;; Copyright (C) 2011 Mathilde BOUTIGNY ;;
77+;; Copyright (C) 2011 Vincent PEYROUSE ;;
78+;; Copyright (C) 2011 Germain CARRÉ ;;
79+;; Copyright (C) 2011 Matthis FRENAY ;;
80+;; ;;
81+;; HangMan is free software: you can redistribute it and/or modify ;;
82+;; it under the terms of the GNU General Public License as published by ;;
83+;; the Free Software Foundation, either version 3 of the License, or ;;
84+;; (at your option) any later version. ;;
85+;; ;;
86+;; This program is distributed in the hope that it will be useful, ;;
87+;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;
88+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;
89+;; GNU General Public License for more details. ;;
90+;; ;;
91+;; You should have received a copy of the GNU General Public License ;;
92+;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;
93+;; ;;
94+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
95+
96+
97+;;
98+;; Contains the options menu.
99+;;
100+;; Index:
101+;; _option_menu() -- Displays the option menu.
102+;; _draw_option_menu() -- (Re)draws the option menu on the screen.
103+;;
104+
105+
106+
107+OPTION_GIBBET db 1
108+OPTION_GIBBET_ON equ 1
109+OPTION_GIBBET_OFF equ 0
110+
111+
112+OPTION_DICT db 0
113+OPTION_DICT_EN equ 0
114+OPTION_DICT_FR equ 1
115+
116+
117+
118+;========================================================= _option_menu() ====
119+;; Displays the option menu.
120+
121+;; Using:
122+;; call _option_menu
123+
124+
125+_option_menu:
126+
127+;Flush the input buffer
128+mov ah, 0x0C
129+mov al, 0
130+int 0x21
131+
132+;Draw the UI
133+call _draw_ui
134+
135+;Print the help message
136+mov HELP_STR, offset option_menu_help
137+call _print_help
138+jmp option_menu_refresh
139+
140+option_menu_snd:
141+ mov SOUND, offset SND_MENU_CH_ITEM
142+ call _draw_option_menu
143+ call _play_sound
144+ jmp option_menu_loop
145+
146+option_menu_refresh:
147+ call _draw_option_menu
148+
149+option_menu_loop:
150+ ;Wait for input
151+ mov ah, 0x00
152+ int 0x16
153+
154+ cmp al, ' ' ;Space
155+ jz option_menu_validate
156+ cmp al, 0x0D ;Enter
157+ jz option_menu_validate
158+ cmp ah, 0x4B ;Left arrow
159+ jz option_menu_validate
160+ cmp ah, 0x4D ;Right arrow
161+ jz option_menu_validate
162+ cmp ah, 0x50 ;Down arrow
163+ jz option_menu_movedown
164+ cmp ah, 0x48 ;Up arrow
165+ jz option_menu_moveup
166+ cmp ax, 0x011B ;Escape
167+ jz option_menu_end
168+
169+ ;Not a valid input
170+ jmp option_menu_loop
171+
172+ ;Move down
173+ option_menu_movedown:
174+ inc option_menu_selected
175+
176+ cmp option_menu_selected, option_menu_items_numb
177+ jnz option_menu_snd
178+
179+ mov option_menu_selected, 0
180+ jmp option_menu_snd
181+
182+ ;Move up
183+ option_menu_moveup:
184+ dec option_menu_selected
185+
186+ cmp option_menu_selected, -1
187+ jnz option_menu_snd
188+
189+ mov option_menu_selected, option_menu_items_numb
190+ dec option_menu_selected
191+ jmp option_menu_snd
192+
193+ ;Validate
194+ option_menu_validate:
195+ mov SOUND, offset SND_MENU_VALID
196+ call _play_sound
197+
198+ ;Gibbet
199+ cmp option_menu_selected, OPTION_MENU_GIBBET
200+ jnz option_menu_gibbet_end
201+ not OPTION_GIBBET
202+ and OPTION_GIBBET, 00000001b
203+ option_menu_gibbet_end:
204+
205+ ;Dictionary
206+ cmp option_menu_selected, OPTION_MENU_DICT
207+ jnz option_menu_dict_end
208+ not OPTION_DICT
209+ and OPTION_DICT, 00000001b
210+ option_menu_dict_end:
211+
212+ ;Dictionary
213+ cmp option_menu_selected, OPTION_MENU_BACK
214+ jnz option_menu_back_end
215+ jmp option_menu_end
216+ option_menu_back_end:
217+
218+ jmp option_menu_refresh
219+
220+option_menu_end:
221+
222+ret
223+
224+
225+
226+;==================================================== _draw_option_menu() ====
227+;; (Re)draws the option menu on the screen.
228+
229+;; Using:
230+;; call _draw_option_menu
231+
232+
233+_draw_option_menu:
234+
235+call _clear_working
236+
237+;Calclulate the position of the first item
238+mov POS_X, COLS / 2 - 15
239+mov POS_Y, header_height
240+add POS_Y, 4
241+
242+call _move_cursor
243+
244+mov ah, 0x09
245+
246+;Print the GIBBET item
247+cmp OPTION_GIBBET, OPTION_GIBBET_ON
248+je droption_gibbet_on
249+;GIBBET = OFF
250+mov dx, offset option_item_gibbet_off
251+jmp droption_gibbet_end
252+droption_gibbet_on: ;GIBBET = ON
253+mov dx, offset option_item_gibbet_on
254+droption_gibbet_end:
255+int 0x21 ;Print
256+
257+add POS_Y, 2
258+call _move_cursor
259+
260+;Print the DICTIONARY item
261+cmp OPTION_DICT, OPTION_DICT_FR
262+je droption_dict_fr
263+;DICT = EN
264+mov dx, offset option_item_dict_en
265+jmp droption_dict_end
266+droption_dict_fr: ;DICT = FR
267+mov dx, offset option_item_dict_fr
268+droption_dict_end:
269+int 0x21 ;Print
270+
271+add POS_Y, 2
272+call _move_cursor
273+
274+;Print the BACK item
275+mov dx, offset option_item_backmain
276+int 0x21 ;Print
277+
278+;=> Print the arrow (selected item)
279+;Calclulate the position of the selected item
280+mov POS_X, COLS / 2 - 15 - 2
281+mov POS_Y, header_height
282+add POS_Y, 4
283+mov ah, 0x00
284+mov al, option_menu_selected
285+mov bl, 2
286+mul bl
287+add pos_y, al
288+
289+call _move_cursor
290+
291+mov ah, 0x09
292+mov al, 0x10
293+mov bh, 0
294+mov bl, COLOR_CURSOR ; color
295+mov cx, 1
296+int 0x10
297+
298+ret
299+
300+
301+
302+;======================== Vars for _option_menu() and _draw_option_menu() ====
303+option_menu_selected db 0 ;The selected item of the menu
304+
305+
306+
307+;======================= Datas for _option_menu() and _draw_option_menu() ====
308+option_menu_help db 0xDA,0x18,0x19,0xBF," Navigate ",0xDA,"Enter",0xBF
309+ db " Validate / Toggle options ",0xDA
310+ db "Esc",0xBF, " Quit$"
311+
312+option_item_gibbet_on db "Gibbet [ With ] Without $"
313+option_item_gibbet_off db "Gibbet With [ Without ]$"
314+OPTION_MENU_GIBBET equ 0
315+
316+option_item_dict_en db "Dictionary [ English ] French $"
317+option_item_dict_fr db "Dictionary English [ French ]$"
318+OPTION_MENU_DICT equ 1
319+
320+option_item_backmain db "Back$"
321+OPTION_MENU_BACK equ 2
322+
323+option_menu_items_numb equ 3
324+
325
326=== modified file 'singlepl.asm'
327--- singlepl.asm 2011-05-26 14:19:39 +0000
328+++ singlepl.asm 2011-05-31 13:06:33 +0000
329@@ -76,7 +76,13 @@
330 mul bl
331
332 ;Adress of the word
333- mov bx, offset WORD_LIST
334+ cmp OPTION_DICT, OPTION_DICT_FR
335+ je sp_dict_fr
336+ mov bx, offset WORD_LIST_EN
337+ jmp sp_dict_end
338+ sp_dict_fr:
339+ mov bx, offset WORD_LIST_FR
340+ sp_dict_end:
341 add bx, ax
342
343 mov WORD, bx
344
345=== modified file 'words.res'
346--- words.res 2011-05-22 16:39:28 +0000
347+++ words.res 2011-05-31 13:06:33 +0000
348@@ -41,7 +41,7 @@
349 ;============================================================== Word List ====
350 ; All fields must have a length of 25 bytes, the end of a word is marked by
351 ; the '$' char.
352-WORD_LIST db "ENGLISH$ "
353+WORD_LIST_EN db "ENGLISH$ "
354 db "INDENTATION$ "
355 db "ASSEMBLY$ "
356 db "COMPUTER$ "
357@@ -142,6 +142,109 @@
358 db "AGGLOMERATIONS$ "
359 db "AGROCHEMICALS$ "
360
361+
362+WORD_LIST_FR db "CACHETTERAIENt$ "
363+ db "ECLAIRAGISTES$ "
364+ db "QUADRILLERAIENT$ "
365+ db "INTUSSUSCEPTION$ "
366+ db "NATIONALISATIONS$ "
367+ db "ACCEPTATIONS$ "
368+ db "ABSTRAYAIENT$ "
369+ db "DEBARBOUILLERIONS$ "
370+ db "CHLOROPHYLLIENNES$ "
371+ db "ELECTROMAGNETIQUES$ "
372+ db "URBANISERAIENT$ "
373+ db "POLTRONNERIES$ "
374+ db "ROUSPETEUSES$ "
375+ db "ECLABOUSSERIONS$ "
376+ db "LYMPHATIQUES$ "
377+ db "YOUGOSLAVES$ "
378+ db "FABRIQUERAIENT$ "
379+ db "NEUROLINGUISTIQUE$ "
380+ db "GOUVERNEMENTALISME$ "
381+ db "BYZANTINOLOGUE$ "
382+ db "FREQUENTATIONS$ "
383+ db "FRACTURASSIEZ$ "
384+ db "CLOISONNEMENTS$ "
385+ db "GALVANISERAIENT$ "
386+ db "CHOCOLATIERES$ "
387+ db "ELUCUBRATIONS$ "
388+ db "KERATINISASSIONS$ "
389+ db "COADMINISTRATRICES$ "
390+ db "PAILLASSONNASSIONS$ "
391+ db "ULTRAMONTANISME$ "
392+ db "OBSTRUCTIONNISTES$ "
393+ db "IGNOMINIEUSEMENT$ "
394+ db "NAPOLITAINES$ "
395+ db "JORDANIENNES$ "
396+ db "DUBITATIVEMENT$ "
397+ db "FRUCTIFIERAIENT$ "
398+ db "INCURVERAIENT$ "
399+ db "QUANTIFICATIONS$ "
400+ db "BONIFICATIONS$ "
401+ db "CLIGNOTEMENT$ "
402+ db "SACRAMENTELLES$ "
403+ db "ZIGZAGUERIONS$ "
404+ db "KINESITHERAPEUTES$ "
405+ db "TAMBOURINAMES$ "
406+ db "BEUVERIES$ "
407+ db "NUTRITIONNISTE$ "
408+ db "NASONNEMENT$ "
409+ db "UNIDIRECTIONNELLES$ "
410+ db "BOUILLOTTERAIENT$ "
411+ db "SACCHARIFICATION$ "
412+ db "EMANCIPATEURS$ "
413+ db "JUSTIFIERIONS$ "
414+ db "DYSORTHOGRAPHIES$ "
415+ db "CYTOPLASMIQUE$ "
416+ db "RACCOUTUMERAIENT$ "
417+ db "AROMATISATIONS$ "
418+ db "TYROLIENNES$ "
419+ db "VADROUILLIONS$ "
420+ db "DEBLOQUERAIENT$ "
421+ db "DRAMATISATIONS$ "
422+ db "BRINGUEBALAIENT$ "
423+ db "OBLIGATOIREMENT$ "
424+ db "ECARQUILLASSIONS$ "
425+ db "WURTEMBERGEOISE$ "
426+ db "MERINGUASSIONS$ "
427+ db "MOTORISATIONS$ "
428+ db "GUILLOTINERENT$ "
429+ db "BIJOUTERIES$ "
430+ db "ZOOTHERAPEUTIQUE$ "
431+ db "MERCURIELLES$ "
432+ db "MOUCHARDASSENT$ "
433+ db "TACHISTOSCOPIQUE$ "
434+ db "VAPORISATIONS$ "
435+ db "RUISSELLEMENTS$ "
436+ db "KILOGRAMMES$ "
437+ db "AFFRANCHISSIONS$ "
438+ db "GALACTIQUES$ "
439+ db "BACTERIOLOGISTES$ "
440+ db "HARCELERAIENT$ "
441+ db "BIBERONNASSIONS$ "
442+ db "ACCLIMATAIENT$ "
443+ db "XIPHOIDIENNES$ "
444+ db "HACHURERIONS$ "
445+ db "LORGNETTES$ "
446+ db "JALOUSASSIONS$ "
447+ db "HYPOSECRETION$ "
448+ db "CHAUMASSIONS$ "
449+ db "FLANCONADE$ "
450+ db "OCCASIONNELLEMENT$ "
451+ db "BADIGEONNASSIONS$ "
452+ db "ADMINISTRASSIONS$ "
453+ db "PALMIPEDES$ "
454+ db "MACHINATIONS$ "
455+ db "LABORIEUSEMENT$ "
456+ db "WISIGOTHIQUES$ "
457+ db "SABOULASSENT$ "
458+ db "HALLUCINOGENES$ "
459+ db "SPECTROSCOPISTES$ "
460+ db "DECUVERAIENT$ "
461+ db "EBAUDISSENT$ "
462+
463+
464 WORD_LEN equ 25 ;The length of every fields
465 WORD_LIST_LEN equ 100 ;The number of words in the list
466

Subscribers

People subscribed via source and target branches