← Back to team overview

hangman8086-devs team mailing list archive

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

 

Fabien LOISON (FLOZz) has proposed merging lp:~flozz/hangman8086/options into lp:hangman8086.

Requested reviews:
  Vincent PEYROUSE (GodezInc) (godezinc)

For more details, see:
https://code.launchpad.net/~flozz/hangman8086/options/+merge/62979

Option menu implemented
With/Without gibbet option added
French word list added (+option)
-- 
https://code.launchpad.net/~flozz/hangman8086/options/+merge/62979
Your team Hangman 8086 Developers is subscribed to branch lp:hangman8086.
=== modified file '.bzrignore'
--- .bzrignore	2011-05-16 14:31:51 +0000
+++ .bzrignore	2011-05-31 13:06:33 +0000
@@ -1,3 +1,4 @@
 *.com*
 *.sh
 buildenv
+dosbox

=== modified file 'game.asm'
--- game.asm	2011-05-26 14:19:39 +0000
+++ game.asm	2011-05-31 13:06:33 +0000
@@ -257,7 +257,13 @@
     jne game_init_sploop
 
 ;Init the play_lives to 10 (with gibbet) or 6 (without gibbet)
-mov play_lives, 10 ;FIXME
+cmp OPTION_GIBBET, OPTION_GIBBET_ON
+je  game_init_lives_gibbet_on
+mov play_lives, 6
+jmp game_init_lives_gibbet_end
+game_init_lives_gibbet_on:
+mov play_lives, 10
+game_init_lives_gibbet_end:
 
 ;Restore registers
 pop dx

=== modified file 'main.asm'
--- main.asm	2011-05-26 14:19:39 +0000
+++ main.asm	2011-05-31 13:06:33 +0000
@@ -64,6 +64,7 @@
 include "stscreen.asm" ;Contains the function that print the startup screen.
 include "game.asm"     ;Contains the game functions.
 include "singlepl.asm" ;Contains the single player mode.
+include "options.asm"  ;Contains the options menu.
 
 ;RESOURCE
 include "asciiart.res" ;Contains the ASCII art of the game.

=== modified file 'mainmenu.asm'
--- mainmenu.asm	2011-05-26 14:19:39 +0000
+++ mainmenu.asm	2011-05-31 13:06:33 +0000
@@ -133,6 +133,13 @@
         jmp _main_menu
         main_menu_sp_end:
 
+        ;Options
+        cmp main_menu_selected, MAIN_MENU_OPTIONS
+        jne main_menu_option_end
+        call _option_menu
+        jmp _main_menu
+        main_menu_option_end:
+
         ;Quit
         cmp main_menu_selected, MAIN_MENU_QUIT
         je main_menu_end

=== added file 'options.asm'
--- options.asm	1970-01-01 00:00:00 +0000
+++ options.asm	2011-05-31 13:06:33 +0000
@@ -0,0 +1,262 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;      __   __  _______  __    _  _______  __   __  _______  __    _       ;;
+;;     |  | |  ||   _   ||  |  | ||       ||  |_|  ||   _   ||  |  | |      ;;
+;;     |  |_|  ||  |_|  ||   |_| ||    ___||       ||  |_|  ||   |_| |      ;;
+;;     |       ||       ||       ||   | __ |       ||       ||       |      ;;
+;;     |       ||       ||  _    ||   ||  ||       ||       ||  _    |      ;;
+;;     |   _   ||   _   || | |   ||   |_| || ||_|| ||   _   || | |   |      ;;
+;;     |__| |__||__| |__||_|  |__||_______||_|   |_||__| |__||_|  |__|      ;;
+;;                                                                          ;;
+;;                                                                          ;;
+;;  HANGMAN - An implementation of the Hang Man game in assembly (Emu8086)  ;;
+;;                                                                          ;;
+;;  Copyright (C) 2011  Fabien LOISON                                       ;;
+;;  Copyright (C) 2011  Mathilde BOUTIGNY                                   ;;
+;;  Copyright (C) 2011  Vincent PEYROUSE                                    ;;
+;;  Copyright (C) 2011  Germain CARRÉ                                       ;;
+;;  Copyright (C) 2011  Matthis FRENAY                                      ;;
+;;                                                                          ;;
+;;  HangMan is free software: you can redistribute it and/or modify         ;;
+;;  it under the terms of the GNU General Public License as published by    ;;
+;;  the Free Software Foundation, either version 3 of the License, or       ;;
+;;  (at your option) any later version.                                     ;;
+;;                                                                          ;;
+;;  This program is distributed in the hope that it will be useful,         ;;
+;;  but WITHOUT ANY WARRANTY; without even the implied warranty of          ;;
+;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           ;;
+;;  GNU General Public License for more details.                            ;;
+;;                                                                          ;;
+;;  You should have received a copy of the GNU General Public License       ;;
+;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.   ;;
+;;                                                                          ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+;;
+;; Contains the options menu.
+;;
+;; Index:
+;;     _option_menu()       -- Displays the option menu.
+;;     _draw_option_menu()  -- (Re)draws the option menu on the screen.
+;;
+
+
+
+OPTION_GIBBET      db 1
+OPTION_GIBBET_ON  equ 1
+OPTION_GIBBET_OFF equ 0
+
+
+OPTION_DICT     db 0
+OPTION_DICT_EN equ 0
+OPTION_DICT_FR equ 1
+
+
+
+;========================================================= _option_menu() ====
+;; Displays the option menu.
+
+;; Using:
+;; call _option_menu
+
+
+_option_menu:
+
+;Flush the input buffer
+mov ah, 0x0C
+mov al, 0
+int 0x21
+
+;Draw the UI
+call _draw_ui
+
+;Print the help message
+mov HELP_STR, offset option_menu_help
+call _print_help
+jmp option_menu_refresh
+
+option_menu_snd:
+    mov SOUND, offset SND_MENU_CH_ITEM
+    call _draw_option_menu
+    call _play_sound
+    jmp option_menu_loop
+
+option_menu_refresh:
+    call _draw_option_menu
+
+option_menu_loop:
+    ;Wait for input
+    mov ah, 0x00
+    int 0x16
+
+    cmp al, ' '          ;Space
+    jz  option_menu_validate
+    cmp al, 0x0D         ;Enter
+    jz  option_menu_validate
+    cmp ah, 0x4B         ;Left arrow
+    jz  option_menu_validate
+    cmp ah, 0x4D         ;Right arrow
+    jz  option_menu_validate
+    cmp ah, 0x50         ;Down arrow
+    jz  option_menu_movedown
+    cmp ah, 0x48         ;Up arrow
+    jz  option_menu_moveup
+    cmp ax, 0x011B       ;Escape
+    jz  option_menu_end
+
+    ;Not a valid input
+    jmp option_menu_loop
+
+    ;Move down
+    option_menu_movedown:
+        inc option_menu_selected
+
+        cmp option_menu_selected, option_menu_items_numb
+        jnz option_menu_snd
+
+        mov option_menu_selected, 0
+        jmp option_menu_snd
+
+    ;Move up
+    option_menu_moveup:
+        dec option_menu_selected
+
+        cmp option_menu_selected, -1
+        jnz option_menu_snd
+
+        mov option_menu_selected, option_menu_items_numb
+        dec option_menu_selected
+        jmp option_menu_snd
+
+    ;Validate
+    option_menu_validate:
+        mov SOUND, offset SND_MENU_VALID
+        call _play_sound
+
+        ;Gibbet
+        cmp option_menu_selected, OPTION_MENU_GIBBET
+        jnz option_menu_gibbet_end
+        not OPTION_GIBBET
+        and OPTION_GIBBET, 00000001b
+        option_menu_gibbet_end:
+
+        ;Dictionary
+        cmp option_menu_selected, OPTION_MENU_DICT
+        jnz option_menu_dict_end
+        not OPTION_DICT
+        and OPTION_DICT, 00000001b
+        option_menu_dict_end:
+
+        ;Dictionary
+        cmp option_menu_selected, OPTION_MENU_BACK
+        jnz option_menu_back_end
+        jmp option_menu_end
+        option_menu_back_end:
+
+        jmp option_menu_refresh
+
+option_menu_end:
+
+ret
+
+
+
+;==================================================== _draw_option_menu() ====
+;; (Re)draws the option menu on the screen.
+
+;; Using:
+;; call _draw_option_menu
+
+
+_draw_option_menu:
+
+call _clear_working
+
+;Calclulate the position of the first item
+mov POS_X, COLS / 2 - 15
+mov POS_Y, header_height
+add POS_Y, 4
+
+call _move_cursor
+
+mov ah, 0x09
+
+;Print the GIBBET item
+cmp OPTION_GIBBET, OPTION_GIBBET_ON
+je  droption_gibbet_on
+;GIBBET = OFF
+mov dx, offset option_item_gibbet_off
+jmp droption_gibbet_end
+droption_gibbet_on: ;GIBBET = ON
+mov dx, offset option_item_gibbet_on
+droption_gibbet_end:
+int 0x21 ;Print
+
+add POS_Y, 2
+call _move_cursor
+
+;Print the DICTIONARY item
+cmp OPTION_DICT, OPTION_DICT_FR
+je  droption_dict_fr
+;DICT = EN
+mov dx, offset option_item_dict_en
+jmp droption_dict_end
+droption_dict_fr: ;DICT = FR
+mov dx, offset option_item_dict_fr
+droption_dict_end:
+int 0x21 ;Print
+
+add POS_Y, 2
+call _move_cursor
+
+;Print the BACK item
+mov dx, offset option_item_backmain
+int 0x21 ;Print
+
+;=> Print the arrow (selected item)
+;Calclulate the position of the selected item
+mov POS_X, COLS / 2 - 15 - 2
+mov POS_Y, header_height
+add POS_Y, 4
+mov ah, 0x00
+mov al, option_menu_selected
+mov bl, 2
+mul bl
+add pos_y, al
+
+call _move_cursor
+
+mov ah, 0x09
+mov al, 0x10
+mov bh, 0
+mov bl, COLOR_CURSOR ; color
+mov cx, 1
+int 0x10
+
+ret
+
+
+
+;======================== Vars for _option_menu() and _draw_option_menu() ====
+option_menu_selected db 0  ;The selected item of the menu
+
+
+
+;======================= Datas for _option_menu() and _draw_option_menu() ====
+option_menu_help  db 0xDA,0x18,0x19,0xBF," Navigate   ",0xDA,"Enter",0xBF
+                db " Validate / Toggle options                   ",0xDA
+                db "Esc",0xBF, " Quit$"
+
+option_item_gibbet_on   db "Gibbet      [ With ]   Without  $"
+option_item_gibbet_off  db "Gibbet        With   [ Without ]$"
+OPTION_MENU_GIBBET     equ 0
+
+option_item_dict_en     db "Dictionary  [ English ]   French  $"
+option_item_dict_fr     db "Dictionary    English   [ French ]$"
+OPTION_MENU_DICT       equ 1
+
+option_item_backmain    db "Back$"
+OPTION_MENU_BACK       equ 2
+
+option_menu_items_numb equ 3
+

=== modified file 'singlepl.asm'
--- singlepl.asm	2011-05-26 14:19:39 +0000
+++ singlepl.asm	2011-05-31 13:06:33 +0000
@@ -76,7 +76,13 @@
     mul bl
 
     ;Adress of the word
-    mov bx, offset WORD_LIST
+    cmp OPTION_DICT, OPTION_DICT_FR
+    je  sp_dict_fr
+    mov bx, offset WORD_LIST_EN
+    jmp sp_dict_end
+    sp_dict_fr:
+    mov bx, offset WORD_LIST_FR
+    sp_dict_end:
     add bx, ax
 
 mov WORD, bx

=== modified file 'words.res'
--- words.res	2011-05-22 16:39:28 +0000
+++ words.res	2011-05-31 13:06:33 +0000
@@ -41,7 +41,7 @@
 ;============================================================== Word List ====
 ; All fields must have a length of 25 bytes, the end of a word is marked by
 ; the '$' char.
-WORD_LIST     db  "ENGLISH$                 "
+WORD_LIST_EN  db  "ENGLISH$                 "
               db  "INDENTATION$             "
               db  "ASSEMBLY$                "
               db  "COMPUTER$                "
@@ -142,6 +142,109 @@
               db  "AGGLOMERATIONS$          "
               db  "AGROCHEMICALS$           "
 
+
+WORD_LIST_FR  db  "CACHETTERAIENt$          "
+              db  "ECLAIRAGISTES$           "
+              db  "QUADRILLERAIENT$         "
+              db  "INTUSSUSCEPTION$         "
+              db  "NATIONALISATIONS$        "
+              db  "ACCEPTATIONS$            "
+              db  "ABSTRAYAIENT$            "
+              db  "DEBARBOUILLERIONS$       "
+              db  "CHLOROPHYLLIENNES$       "
+              db  "ELECTROMAGNETIQUES$      "
+              db  "URBANISERAIENT$          "
+              db  "POLTRONNERIES$           "
+              db  "ROUSPETEUSES$            "
+              db  "ECLABOUSSERIONS$         "
+              db  "LYMPHATIQUES$            "
+              db  "YOUGOSLAVES$             "
+              db  "FABRIQUERAIENT$          "
+              db  "NEUROLINGUISTIQUE$       "
+              db  "GOUVERNEMENTALISME$      "
+              db  "BYZANTINOLOGUE$          "
+              db  "FREQUENTATIONS$          "
+              db  "FRACTURASSIEZ$           "
+              db  "CLOISONNEMENTS$          "
+              db  "GALVANISERAIENT$         "
+              db  "CHOCOLATIERES$           "
+              db  "ELUCUBRATIONS$           "
+              db  "KERATINISASSIONS$        "
+              db  "COADMINISTRATRICES$      "
+              db  "PAILLASSONNASSIONS$      "
+              db  "ULTRAMONTANISME$         "
+              db  "OBSTRUCTIONNISTES$       "
+              db  "IGNOMINIEUSEMENT$        "
+              db  "NAPOLITAINES$            "
+              db  "JORDANIENNES$            "
+              db  "DUBITATIVEMENT$          "
+              db  "FRUCTIFIERAIENT$         "
+              db  "INCURVERAIENT$           "
+              db  "QUANTIFICATIONS$         "
+              db  "BONIFICATIONS$           "
+              db  "CLIGNOTEMENT$            "
+              db  "SACRAMENTELLES$          "
+              db  "ZIGZAGUERIONS$           "
+              db  "KINESITHERAPEUTES$       "
+              db  "TAMBOURINAMES$           "
+              db  "BEUVERIES$               "
+              db  "NUTRITIONNISTE$          "
+              db  "NASONNEMENT$             "
+              db  "UNIDIRECTIONNELLES$      "
+              db  "BOUILLOTTERAIENT$        "
+              db  "SACCHARIFICATION$        "
+              db  "EMANCIPATEURS$           "
+              db  "JUSTIFIERIONS$           "
+              db  "DYSORTHOGRAPHIES$        "
+              db  "CYTOPLASMIQUE$           "
+              db  "RACCOUTUMERAIENT$        "
+              db  "AROMATISATIONS$          "
+              db  "TYROLIENNES$             "
+              db  "VADROUILLIONS$           "
+              db  "DEBLOQUERAIENT$          "
+              db  "DRAMATISATIONS$          "
+              db  "BRINGUEBALAIENT$         "
+              db  "OBLIGATOIREMENT$         "
+              db  "ECARQUILLASSIONS$        "
+              db  "WURTEMBERGEOISE$         "
+              db  "MERINGUASSIONS$          "
+              db  "MOTORISATIONS$           "
+              db  "GUILLOTINERENT$          "
+              db  "BIJOUTERIES$             "
+              db  "ZOOTHERAPEUTIQUE$        "
+              db  "MERCURIELLES$            "
+              db  "MOUCHARDASSENT$          "
+              db  "TACHISTOSCOPIQUE$        "
+              db  "VAPORISATIONS$           "
+              db  "RUISSELLEMENTS$          "
+              db  "KILOGRAMMES$             "
+              db  "AFFRANCHISSIONS$         "
+              db  "GALACTIQUES$             "
+              db  "BACTERIOLOGISTES$        "
+              db  "HARCELERAIENT$           "
+              db  "BIBERONNASSIONS$         "
+              db  "ACCLIMATAIENT$           "
+              db  "XIPHOIDIENNES$           "
+              db  "HACHURERIONS$            "
+              db  "LORGNETTES$              "
+              db  "JALOUSASSIONS$           "
+              db  "HYPOSECRETION$           "
+              db  "CHAUMASSIONS$            "
+              db  "FLANCONADE$              "
+              db  "OCCASIONNELLEMENT$       "
+              db  "BADIGEONNASSIONS$        "
+              db  "ADMINISTRASSIONS$        "
+              db  "PALMIPEDES$              "
+              db  "MACHINATIONS$            "
+              db  "LABORIEUSEMENT$          "
+              db  "WISIGOTHIQUES$           "
+              db  "SABOULASSENT$            "
+              db  "HALLUCINOGENES$          "
+              db  "SPECTROSCOPISTES$        "
+              db  "DECUVERAIENT$            "
+              db  "EBAUDISSENT$             "
+
+
 WORD_LEN      equ  25 ;The length of every fields
 WORD_LIST_LEN equ 100 ;The number of words in the list
 


Follow ups