/************************************************************************** * * Othello II v2.53 - 08/02/2004 * * Copyright (C) 2000-2004 François LEIBER * * This file is part of Othello II. * * Othello II 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 2 of the License, or * (at your option) any later version. * * Othello II 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *************************************************************************/ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Affiche des infos sur Othello II ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void about() { FontSetSys(PETIT); fill_rect(21, 30, 136, 90, 0, 3); draw_str(22, 73, fr_eng("Compilé avec Ti-GCC le 08/02/04", "Compiled with Ti-GCC 02-08-04"), 1, 3); draw_str(31, 81, fr_eng(" Distribué sous licence GPL", "Powered by the GPL License"), 1, 3); draw_str(41, 60, "http://leiber.free.fr/", 1, 3); draw_line(42, 66, 115, 66, 1, 3); FontSetSys(NORMAL); draw_str(42, 32, "Version 2.53", 1, 3); draw_str(41, 33, "Version 2.53", 1, 2); draw_str(fr_eng(21, 24), 44, fr_eng("par François LEIBER", "by Francois LEIBER"), 1, 3); draw_line(fr_eng(22, 25), 53, fr_eng(134, 131), 53, 1, 2); restaure_contraste(); attend_touche(0); baisse_contraste(110); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Affiche un menu d'options, accessible à partir du menu principal ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void options() { short i = 0; FontSetSys(PETIT); set_pion_ordonnee(32); fill_rect(22, 31, 135, 89, 1, 1); fill_rect(22, 31, 135, 89, 0, 2); draw_line(23, 55, 134, 55, 2, 3); afficher_texte_box(59, fr_eng(78, 52), fr_eng(80, 54), Son, fr_eng("Activer son", "Sound on")); afficher_texte_box(67, fr_eng(78, 48), fr_eng(82, 52), Tips, fr_eng("Afficher marques", "Markings on")); afficher_texte_box(75, fr_eng(109, 48), fr_eng(111, 50), FaireTourner, fr_eng("Pions tournant en 3D", "3D rotating discs")); afficher_texte_box(83, fr_eng(78, 89), fr_eng(80, 90), Bib, fr_eng("Utiliser bibliothèque", "Use opening library")); FontSetSys(NORMAL); draw_str(35, 33, fr_eng("NOIRS:", "BLACKS:"), 1, 2); draw_str(35, 45, fr_eng("BLANCS:", "WHITES:"), 1, 2); restaure_contraste(); do { fill_rect(79, 33, 121, 52, 1, 1); fill_rect(79, 33, 121, 52, 0, 2); draw_str(79, 33, Niveau[JoueurType[NOIR]], 1, 2); draw_str(79, 45, Niveau[JoueurType[BLANC]], 1, 2); attend_touche(1); if (HAUT != 0 || BAS != 0) { draw_pion(24, 32 + 12 * i, 13); draw_pion(126, 32 + 12 * i, 13); set_pion_ordonnee(32 + 12 * (i ^= 1)); } JoueurType[i ^ 1] = (JoueurType[i ^ 1] + (DROITE != 0) - (GAUCHE != 0) + 9) % 9; if (O != 0) { Son ^= 1; cocher(59); } if (M != 0) { Tips ^= 1; cocher(67); } if (N3 != 0) { FaireTourner ^= 1; cocher(75); } if (fr_eng(I, L) != 0) { Bib ^= 1; cocher(83); } } while (ESCAPE == 0 && ENTER == 0); baisse_contraste(110); set_pion_ordonnee(56); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Affiche le menu apparaissant au début (moment = 0) ou accessible en cours de partie avec ECHAP (moment = 1) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void menu(short moment) { static short titre[] = { 19, 128, 65535, 61439, 60416, 28669, 32792, 511, 65472, 6240, 65535, 61439, 60416, 28669, 32792, 511, 65472, 6240, // Dessin du titre "Othello II" 49152, 57407, 60416, 27649, 32792, 384, 448, 6240, 49152, 24639, 60416, 27649, 32792, 384, 192, 6240, 49152, 24632, 3072, 27649, 32792, 384, 192, 6240, 49152, 24632, 3072, 27649, 32792, 384, 192, 6240, 49152, 24632, 3072, 27649, 32792, 384, 192, 6240, 49152, 24632, 3072, 60417, 32792, 384, 192, 6240, 49152, 24632, 4095, 61437, 32792, 384, 192, 6240, 49152, 24632, 4095, 61437, 49180, 384, 192, 7280, 49152, 24632, 3968, 61313, 57374, 384, 192, 7800, 49152, 24632, 3968, 28545, 61471, 384, 192, 8060, 49152, 24632, 3968, 28545, 61471, 384, 192, 8060, 49152, 24632, 3968, 28545, 61471, 384, 192, 8060, 49152, 24632, 3968, 28545, 61471, 384, 192, 8060, 49152, 24632, 3968, 28545, 61471, 384, 192, 8060, 49152, 57400, 3968, 28545, 61471, 384, 448, 8060, 65535, 57400, 3968, 28669, 65503, 65023, 65472, 8060, 65535, 57392, 3840, 28669, 65503, 65023, 65472, 7800 }; short j = 0; set_pion_ordonnee(32); FontSetSys(NORMAL); baisse_contraste(110 * moment); Debut: GKeyFlush(); clr(); // Met en place l'interface du menu fill_rect(0, 0, 159, 99, 1, 1); draw_rect(1, 1, 158, 98, 2, 3); draw_rect(2, 2, 157, 97, 1, 2); bitmap_put(17, 7, (char *)titre, 2, 3); bitmap_put(16, 6, (char *)titre, 1, 2); draw_rect(20, 29, 137, 91, 0, 1); draw_rect(21, 30, 136, 90, 1, 2); if (moment) { draw_str(34, 33, fr_eng("CONTINUER", "RESUME"), 1, 2); draw_str(34, 45, fr_eng("NOUVELLE PARTIE", "NEW GAME"), 1, 2); } else { draw_str(34, 33, fr_eng("NOUVELLE PARTIE", "NEW GAME"), 1, 2); draw_str(34, 45, fr_eng("CHARGER PARTIE", "LOAD SAVED GAME"), Sav[0] != 0 ? 1 : 3, 2); } // Affiche en grisé si pas de partie enregistrée draw_str(34, 57, "OPTIONS", 1, 2); draw_str(34, 69, fr_eng("A PROPOS", "ABOUT"), 1, 2); draw_str(34, 81, fr_eng("QUITTER", "QUIT"), 1, 2); restaure_contraste(); do { attend_touche(1); if (HAUT != 0 || BAS != 0) // Déplacement dans le menu { draw_pion(24, 32 + 12 * j, 13); draw_pion(126, 32 + 12 * j, 13); j = (j + (BAS != 0) - (HAUT != 0) + 5) % 5; if (j == 1 && Sav[0] == 0 && moment == 0) j += (BAS != 0) - (HAUT != 0); set_pion_ordonnee(32 + 12 * j); } } while (ENTER == 0 && ESCAPE == 0); if ((ESCAPE != 0 && moment == 0) || (ENTER != 0 && j == 4)) longjmp(JmpQuit, 1); // Quitter baisse_contraste(0); if (ESCAPE == 0) { if (j == (moment != 0)) { Sav[0] = 0; charger(4); } // Nouvelle partie -> idem Charger partie if (j == 1 && moment == 0) charger(64); // Charge la partie enregistrée if (j == 2) { attend(110); options(); goto Debut; } // Options if (j == 3) { attend(60); about(); goto Debut; } // Infos } NbreOrdi = (JoueurType[BLANC] != HUMAIN) + (JoueurType[NOIR] != HUMAIN); Ordi = JoueurType[BLANC] == HUMAIN; dessine_interface(); place_pions(); FontSetSys(PETIT); draw_str(16, 36, Niveau[JoueurType[NOIR]], 1, 2); draw_str(16, 55, Niveau[JoueurType[BLANC]], 1, 2); restaure_contraste(); // Si le menu est appelé pendant le jeu et que 'Continuer' a été choisi if (j == 1 && moment != 0 && ENTER != 0) longjmp(JmpDebut, 1); if (moment != 0) longjmp(JmpReturn, 1); // Si 'moment' est nul (menu appelé en début de partie), JmpReturn[] n'est pas encore défini }