Commit 6f2eaac5 authored by auraes's avatar auraes 💬
Browse files

Mise à jour Puny 39bd8fb

parent d11eb5bf
......@@ -27,6 +27,10 @@ Zcharacter 'û';
Constant PUNYINFORM_MAJOR_VERSION = 1;
Constant PUNYINFORM_MINOR_VERSION = 9;
#Ifndef VN_1634;
Message fatalerror "*** La bibliothèque PunyInform a besoin d'Inform v6.34 ou d'une version ultérieure pour fonctionner ***";
#Endif; ! VN_
#IfnDef CUSTOM_ABBREVIATIONS;
Abbreviate ". ";
Abbreviate ", ";
......@@ -67,6 +71,14 @@ Constant comma_word = 'comma,'; ! An "untypeable word" used to substitute
Constant DEFAULT_CAPACITY = 100;
#Endif;
#Ifdef OPTIONAL_PROVIDE_UNDO;
#IfV3;
Message warning "*** Annuler n'est pas pris en charge pour la version 3 ***";
#IfNot;
Constant OPTIONAL_PROVIDE_UNDO_FINAL;
#Endif;
#Endif;
#Ifndef OPTIONAL_NO_DARKNESS;
Attribute light;
#Endif;
......@@ -333,6 +345,9 @@ Array StorageForShortName buffer 12; !Warning, valeur à ne pas dépasser
! Header constants
Constant HDR_DICTIONARY = $8; ! Actual address
Constant HDR_STATIC_MEM = $e; ! Actual address
Constant HDR_SCREENHCHARS = $20;
Constant HDR_SCREENWCHARS = $21;
Constant HDR_FLAGS2 = $10; ! transcript, undo etc.
Constant TT_OBJECT = 1; ! one or more words referring to an object
! it is one of NOUN_TOKEN etc. below
......@@ -379,8 +394,6 @@ Constant FORM_INDEF = 3;
Constant DICT_BYTES_FOR_WORD = 4;
#IfNot;
Constant DICT_BYTES_FOR_WORD = 6;
Constant HDR_SCREENHCHARS = $20;
Constant HDR_SCREENWCHARS = $21;
!FRENCH
Constant MOVES__TX = " Tour : "; !TODO Tour(s) énième ?
......@@ -409,6 +422,7 @@ Global status_field_1 = 0; ! Must be the second global to show score or hours
Global status_field_2 = 0; ! Must be the third global to show turns or minutes
Global real_location;
Global score;
Global undo_flag;
Global notify_mode = true; ! Score notification
#Ifndef sys_statusline_flag;
Global sys_statusline_flag = 0; ! non-zero if status line displays time
......
......@@ -1299,7 +1299,6 @@ Verb meta 'quitter' 'q//'
! ---------------------
#IfDef OPTIONAL_EXTENDED_METAVERBS;
Constant HDR_GAMEFLAGS $10;
Global transcript_mode = false; ! true when game scripting is on
Global xcommsdir = false; ! true if command recording is on
......@@ -1387,21 +1386,21 @@ Verb meta 'vérifier'
#Endif; ! NO_PLACES
[ ScriptOnSub;
transcript_mode = ((HDR_GAMEFLAGS-->0) & 1);
transcript_mode = ((HDR_FLAGS2-->0) & 1);
if (transcript_mode) "Une transcription est déjà en cours.";
@output_stream 2;
if (((HDR_GAMEFLAGS-->0) & 1) == 0) "La tentative de commencer la transcription a échoué.";
if (((HDR_FLAGS2-->0) & 1) == 0) "La tentative de commencer la transcription a échoué.";
print "Début de la transcription de^";
Banner();
transcript_mode = true;
];
[ ScriptOffSub;
transcript_mode = ((HDR_GAMEFLAGS-->0) & 1);
transcript_mode = ((HDR_FLAGS2-->0) & 1);
if (transcript_mode == false) "Aucune transcription n'est en cours.";
print "^Fin de la transcription.^";
@output_stream -2;
if ((HDR_GAMEFLAGS-->0) & 1) "Impossible de terminer la transcription.";
if ((HDR_FLAGS2-->0) & 1) "Impossible de terminer la transcription.";
transcript_mode = false;
];
......@@ -1895,21 +1894,10 @@ Global scope_cnt;
[ VerbName p_v ; !FIXME
! first give entry routine a chance to override
if(PrintVerb(p_v)) return;
#IfV3;
switch(p_v) {
'déverrouiller': print "déverrouiller"; return;
'enlever': print "enlever"; return;
'insérer': print "insérer"; return;
'prendre': print "prendre"; return;
'retirer': print "retirer"; return;
'verrouiller': print "verrouiller"; return;
}
#IfNot;
switch(p_v) {
'déverrouiller': print "déverrouiller"; return;
'verrouiller': print "verrouiller"; return;
}
#EndIf;
print (address) p_v;
];
......@@ -284,6 +284,21 @@ Default MSG_EMPTY_CANT_CONTAIN 119; ! Extended verbset, but uses same msg as INS
Default MSG_YES_OR_NO 120;
Default MSG_RESTART_CONFIRM 121;
#IfDef OPTIONAL_PROVIDE_UNDO_FINAL;
#Ifndef MSG_UNDO_NOTHING_DONE;
Constant MSG_UNDO_NOTHING_DONE "Il n'y a aucune action à annuler.";
#EndIf;
#Ifndef MSG_UNDO_NOT_PROVIDED;
Constant MSG_UNDO_NOT_PROVIDED "Votre interpréteur ne permet pas d'annuler.";
#EndIf;
#Ifndef MSG_UNDO_FAILED;
Constant MSG_UNDO_FAILED "Annuler a échoué.";
#EndIf;
#Ifndef MSG_UNDO_DONE;
Constant MSG_UNDO_DONE "L'action précédente a été annulée.";
#EndIf;
#EndIf;
#IfDef OPTIONAL_EXTENDED_VERBSET;
#Ifndef MSG_BURN_DEFAULT;
Constant MSG_BURN_DEFAULT "Commettre un tel acte n'apporterait rien."; !Cela
......
......@@ -1263,6 +1263,30 @@ Object thedark "L'obscurité"
#Endif;
];
#Ifdef OPTIONAL_PROVIDE_UNDO_FINAL;
[ PerformUndo _i;
if (turns == 0) {
PrintMsg(MSG_UNDO_NOTHING_DONE);
return 0;
}
if (undo_flag == 0) {
PrintMsg(MSG_UNDO_NOT_PROVIDED);
return 0;
}
if (undo_flag == 1) {
PrintMsg(MSG_UNDO_FAILED);
return 0;
}
@restore_undo _i;
if (_i == 0) {
PrintMsg(MSG_UNDO_FAILED);
"~Undo~ failed.";
return 0;
}
return 1;
];
#Endif;
[ main _i _j _copylength _sentencelength _parsearraylength _score _again_saved _parser_oops;
#IfV3;
......@@ -1332,6 +1356,23 @@ Object thedark "L'obscurité"
#Endif;
if(parse->1 == 0) {
_ReadPlayerInput();
#Ifdef OPTIONAL_PROVIDE_UNDO_FINAL;
if(parse-->1 == 'undo') {
PerformUndo();
@new_line;
jump abort_input;
}
@save_undo _i;
undo_flag = 2;
if(_i == -1) undo_flag = 0;
if(_i == 0) undo_flag = 1;
if(_i == 2) {
! undo has just been issued
PrintMsg(MSG_UNDO_DONE);
@new_line;
jump abort_input;
}
#Endif;
}
_parser_oops = parser_unknown_noun_found;
.do_it_again;
......@@ -1418,6 +1459,11 @@ Object thedark "L'obscurité"
timer1 = 0-->2 - timer1;
print "[After ParseAndPerformAction took ",timer1," jiffies]^";
#Endif;
continue;
.abort_input;
! skip all processing and force new input
parse->1 = 0;
_sentencelength = 0;
}
_UpdateScoreOrTime();
@new_line;
......@@ -1432,6 +1478,11 @@ Object thedark "L'obscurité"
PrintMsg(MSG_RESTART_RESTORE_OR_QUIT);
_ReadPlayerInput(true);
verb_word = parse-->1;
#Ifdef OPTIONAL_PROVIDE_UNDO_FINAL;
if(verb_word == 'undo') {
PerformUndo();
}
#Endif;
if(verb_word == 'recommencer') @restart;
if(verb_word == 'charger') RestoreSub();
if(AMUSING_PROVIDED == 0 && deadflag == 2 && verb_word == 'bonus') Amusing();
......
......@@ -373,3 +373,5 @@ v2.0: bug fix and new feature release
the capacity property, call ObjectCapacity(object). The default value is the
value of the constant DEFAULT_CAPACITY, which is 100 unless the game code
defines it.
- Added optional undo support
......@@ -65,7 +65,7 @@ System_file;
LTI_Insert(at, ' ');
];
[ DecolleApostrophe motn at lgm; !TODO ssi l' ou d' ?
[ DecolleApostrophe motn at lgm; !TODO ssi s', l' ou d' ?
at = PosMot(motn) + 1;
lgm = WordLength(motn);
if (lgm > 1 && buffer->at == ''')
......@@ -74,7 +74,6 @@ System_file;
];
[ Translation n i w1 w2 r;
!r = 0;
n = NbMotPhrase();
for (i=1: i<=n: i++) {
w1 = DicMot(i);
......@@ -90,30 +89,30 @@ System_file;
w1 = parse-->1;
w2 = parse-->3;
r = 2;
r = 1;
switch (w1) { !y en
'se', 's^': w1 = "se"; r = 1;
'l^': w1 = "-l'"; r = 1;
'se', 's^': w1 = "se";
'l^': w1 = "-l'";
'le':
switch (w2) {
'lui': w1 = "lui -le";
'leur': w1 = "leur -le";
default: w1 = "-le"; r = 1;
'lui': w1 = "lui -le"; r = 2;
'leur': w1 = "leur -le"; r = 2;
default: w1 = "-le";
}
'la':
switch (w2) {
'lui': w1 = "lui -la";
'leur': w1 = "leur -la";
default: w1 = "-la"; r = 1;
'lui': w1 = "lui -la"; r = 2;
'leur': w1 = "leur -la"; r = 2;
default: w1 = "-la";
}
'les':
switch (w2) {
'lui': w1 = "lui -les";
'leur': w1 = "leur -les";
default: w1 = "-les"; r = 1;
'lui': w1 = "lui -les"; r = 2;
'leur': w1 = "leur -les"; r = 2;
default: w1 = "-les";
}
'lui': w1 = "lui"; r = 1;
'leur': w1 = "leur"; r = 1;
'lui': w1 = "lui";
'leur': w1 = "leur";
default: r = 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment