Added a PlayStream function to handle things like "reading the book" or "looking at the map", which allows using the bytecode system instead of C compiled code, resulting in quite a lot of memory saving.
Moved a few remaining hardcoded strings from out the game_main.c file
@@ -92,6 +92,7 @@ | ||
92 | 92 | // game_misc |
93 | 93 | extern void HandleByteStream(); |
94 | 94 | extern void SetByteStream(const char* byteStream); |
95 | +extern void PlayStream(const char* byteStream); | |
95 | 96 | |
96 | 97 | extern const char* gCurrentStream; |
97 | 98 | extern const unsigned int* gCurrentStreamInt; |
@@ -121,6 +121,8 @@ | ||
121 | 121 | extern const char gTextNotDead[]; // "Not dead" - Debugging text |
122 | 122 | extern const char gTextDogJumpingAtMe[]; // "a dog jumping at me" |
123 | 123 | extern const char gTextThugShootingAtMe[]; // "a thug shooting at me" |
124 | +extern const char gTextAGenericWhiteBag[]; // "It's just a white generic bag" | |
125 | +extern const char gTextThickBookBookmarks[]; // "A thick book with some boomarks" | |
124 | 126 | |
125 | 127 | // Error messages |
126 | 128 | extern const char gTextErrorInvalidDirection[]; // "Impossible to move in that direction" |
@@ -147,6 +149,7 @@ | ||
147 | 149 | extern const char gTextErrorAlreadySearched[]; // "You've already frisked him" |
148 | 150 | extern const char gTextErrorInappropriate[]; // "Probably inappropriate" |
149 | 151 | extern const char gTextErrorDeadDontMove[]; // "Dead don't move" |
152 | +extern const char gTextErrorNothingSpecial[]; // "Nothing special" | |
150 | 153 | |
151 | 154 | // Places |
152 | 155 | extern const char gTextLocationMarketPlace[]; // "You are in a deserted market square" |
@@ -262,3 +265,10 @@ | ||
262 | 265 | extern const char gTextItemLadderInTheHole[]; // "a ladder in a hole" |
263 | 266 | extern const char gTextItemeRopeAttachedToATree[]; // "a rope attached to a tree" |
264 | 267 | |
268 | +// Scene actions | |
269 | +extern const char gSceneActionReadNewsPaper[]; | |
270 | +extern const char gSceneActionReadPrintedNote[]; | |
271 | +extern const char gSceneActionReadChemistryRecipes[]; | |
272 | +extern const char gSceneActionReadChemistryBook[]; | |
273 | +extern const char gSceneActionInspectMap[]; | |
274 | + |
@@ -550,15 +550,6 @@ | ||
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
553 | - | |
554 | -void ShowFullScreenItem(int image_id, const char* description) | |
555 | -{ | |
556 | - ClearMessageWindow(16+4); | |
557 | - LoadFileAt(image_id,ImageBuffer); | |
558 | - PrintTopDescription(description); | |
559 | - BlitBufferToHiresWindow(); | |
560 | -} | |
561 | - | |
562 | 553 | char ItemCheck(unsigned char itemId) |
563 | 554 | { |
564 | 555 | if (itemId<e_ITEM_COUNT_) |
@@ -586,31 +577,17 @@ | ||
586 | 577 | switch (itemId) |
587 | 578 | { |
588 | 579 | case e_ITEM_Newspaper: |
589 | - ShowFullScreenItem(LOADER_PICTURE_NEWSPAPER,"The Daily Telegraph, September 29th"); | |
590 | - PrintInformationMessage("I have to find her fast..."); | |
591 | - WaitFrames(50*2); | |
592 | - PrintInformationMessage("...I hope she is fine!"); | |
593 | - WaitFrames(50*2); | |
580 | + PlayStream(gSceneActionReadNewsPaper); | |
594 | 581 | LoadScene(); |
595 | 582 | break; |
596 | 583 | |
597 | 584 | case e_ITEM_PrintedNote: |
598 | - ShowFullScreenItem(LOADER_PICTURE_HANDWRITTEN_NOTE,"A hand written note"); | |
599 | - WaitFrames(50*2); | |
600 | - PrintInformationMessage("That could be useful..."); | |
601 | - WaitFrames(50*2); | |
602 | - PrintInformationMessage("...if I can access it!"); | |
603 | - WaitFrames(50*2); | |
585 | + PlayStream(gSceneActionReadPrintedNote); | |
604 | 586 | LoadScene(); |
605 | 587 | break; |
606 | 588 | |
607 | 589 | case e_ITEM_ChemistryBook: |
608 | - ShowFullScreenItem(LOADER_PICTURE_SCIENCE_BOOK,"A science book"); | |
609 | - WaitFrames(50*2); | |
610 | - PrintInformationMessage("I don't understand much..."); | |
611 | - WaitFrames(50*2); | |
612 | - PrintInformationMessage("...but looks like someone took notes."); | |
613 | - WaitFrames(50*2); | |
590 | + PlayStream(gSceneActionReadChemistryBook); | |
614 | 591 | if (gItems[e_ITEM_ChemistryRecipes].location==e_LOCATION_NONE) |
615 | 592 | { |
616 | 593 | // If the recipes were not yet found, they now appear at the current location |
@@ -620,17 +597,12 @@ | ||
620 | 597 | break; |
621 | 598 | |
622 | 599 | case e_ITEM_ChemistryRecipes: |
623 | - ShowFullScreenItem(LOADER_PICTURE_CHEMISTRY_RECIPES,"A few useful recipes"); | |
624 | - WaitFrames(50*2); | |
625 | - PrintInformationMessage("I can definitely use these..."); | |
626 | - WaitFrames(50*2); | |
627 | - PrintInformationMessage("...just need to find the materials."); | |
628 | - WaitFrames(50*2); | |
600 | + PlayStream(gSceneActionReadChemistryRecipes); | |
629 | 601 | LoadScene(); |
630 | 602 | break; |
631 | 603 | |
632 | 604 | case e_ITEM_PlasticBag: |
633 | - PrintErrorMessage("It's just a white generic bag"); | |
605 | + PrintErrorMessage(gTextAGenericWhiteBag); // "It's just a white generic bag" | |
634 | 606 | break; |
635 | 607 | |
636 | 608 | default: |
@@ -819,18 +791,16 @@ | ||
819 | 791 | switch (itemId) |
820 | 792 | { |
821 | 793 | case e_ITEM_UnitedKingdomMap: |
822 | - ShowFullScreenItem(LOADER_PICTURE_UK_MAP,"A map of the United Kingdom"); | |
823 | - PrintInformationMessage("It shows Ireland, Wales and England"); | |
824 | - WaitFrames(50*2); | |
794 | + PlayStream(gSceneActionInspectMap); | |
825 | 795 | LoadScene(); |
826 | 796 | break; |
827 | 797 | |
828 | 798 | case e_ITEM_ChemistryBook: |
829 | - PrintInformationMessage("A thick book with some boomarks"); | |
799 | + PrintInformationMessage(gTextThickBookBookmarks); // "A thick book with some boomarks" | |
830 | 800 | break; |
831 | 801 | |
832 | 802 | default: |
833 | - PrintErrorMessage("Nothing special"); | |
803 | + PrintErrorMessage(gTextErrorNothingSpecial); // "Nothing special" | |
834 | 804 | break; |
835 | 805 | } |
836 | 806 | } |
@@ -1182,6 +1152,10 @@ | ||
1182 | 1152 | //gCurrentLocation =e_LOCATION_NARROWPATH; |
1183 | 1153 | //gCurrentLocation = e_LOCATION_LIBRARY; |
1184 | 1154 | //gItems[e_ITEM_PlasticBag].location = e_LOCATION_INVENTORY; |
1155 | + | |
1156 | + gItems[e_ITEM_ChemistryBook].location = e_LOCATION_INVENTORY; | |
1157 | + gCurrentLocation =e_LOCATION_LIBRARY; | |
1158 | + | |
1185 | 1159 | #else |
1186 | 1160 | // In normal gameplay, the player starts from the marketplace with an empty inventory |
1187 | 1161 | gCurrentLocation = e_LOCATION_MARKETPLACE; |
@@ -83,7 +83,21 @@ | ||
83 | 83 | } |
84 | 84 | |
85 | 85 | |
86 | +void PlayStream(const char* byteStream) | |
87 | +{ | |
88 | + const char* originalByteStream = gCurrentStream; | |
89 | + gCurrentStream = byteStream; | |
90 | + gDelayStream = 0; | |
86 | 91 | |
92 | + do | |
93 | + { | |
94 | + WaitIRQ(); | |
95 | + HandleByteStream(); | |
96 | + } | |
97 | + while (gCurrentStream); | |
98 | +} | |
99 | + | |
100 | + | |
87 | 101 | // The various commands: |
88 | 102 | // - COMMAND_END indicates the end of the stream |
89 | 103 | // - COMMAND_BUBBLE draws speech bubble and requires a number of parameters: |
@@ -156,6 +170,13 @@ | ||
156 | 170 | } |
157 | 171 | break; |
158 | 172 | |
173 | + case COMMAND_INFO_MESSAGE: | |
174 | + { | |
175 | + PrintInformationMessage(gCurrentStream); // Should probably return the length or pointer to the end of string | |
176 | + gCurrentStream += strlen(gCurrentStream)+1; | |
177 | + } | |
178 | + break; | |
179 | + | |
159 | 180 | case COMMAND_BITMAP: |
160 | 181 | { |
161 | 182 | unsigned char loaderId = *gCurrentStream++; |
@@ -174,6 +195,19 @@ | ||
174 | 195 | } |
175 | 196 | break; |
176 | 197 | |
198 | + case COMMAND_FULLSCREEN_ITEM: | |
199 | + { | |
200 | + unsigned char loaderId = *gCurrentStream++; | |
201 | + | |
202 | + ClearMessageWindow(16+4); | |
203 | + LoadFileAt(loaderId,ImageBuffer); | |
204 | + PrintTopDescription(gCurrentStream); | |
205 | + BlitBufferToHiresWindow(); | |
206 | + | |
207 | + gCurrentStream += strlen(gCurrentStream)+1; | |
208 | + } | |
209 | + break; | |
210 | + | |
177 | 211 | case COMMAND_FADE_BUFFER: |
178 | 212 | BlitBufferToHiresWindow(); |
179 | 213 | break; |
@@ -36,6 +36,8 @@ | ||
36 | 36 | _gTextNotDead .byt "Pas mort",0 // Debugging text |
37 | 37 | _gTextDogJumpingAtMe .byt "un chien qui me saute dessus",0 |
38 | 38 | _gTextThugShootingAtMe .byt "un malfaiteur qui me tire dessus",0 |
39 | +_gTextAGenericWhiteBag .byt "Juste un sac blanc normal",0 | |
40 | +_gTextThickBookBookmarks .byt "Un livre épais avec des marques",0 | |
39 | 41 | #else |
40 | 42 | _gTextAskInput .byt "What are you going to do now?",0 |
41 | 43 | _gTextNothingHere .byt "There is nothing of interest here",0 |
@@ -59,6 +61,8 @@ | ||
59 | 61 | _gTextNotDead .byt "Not dead",0 // Debugging text |
60 | 62 | _gTextDogJumpingAtMe .byt "a dog jumping at me",0 |
61 | 63 | _gTextThugShootingAtMe .byt "a thug shooting at me",0 |
64 | +_gTextAGenericWhiteBag .byt "It's just a white generic bag",0 | |
65 | +_gTextThickBookBookmarks .byt "A thick book with some boomarks",0 | |
62 | 66 | #endif |
63 | 67 | _EndMessagesAndPrompts |
64 | 68 |
@@ -89,6 +93,7 @@ | ||
89 | 93 | _gTextErrorAlreadySearched .byt "Vous l'avez déjà fouillé",0 |
90 | 94 | _gTextErrorInappropriate .byt "Probablement inapproprié",0 |
91 | 95 | _gTextErrorDeadDontMove .byt "Les morts ne bougent pas",0 |
96 | +_gTextErrorNothingSpecial .byt "Rien de spécial",0 | |
92 | 97 | #else |
93 | 98 | _gTextErrorInvalidDirection .byt "Impossible to move in that direction",0 |
94 | 99 | _gTextErrorCantTakeNoSee .byt "You can only take something you see",0 |
@@ -114,6 +119,7 @@ | ||
114 | 119 | _gTextErrorAlreadySearched .byt "You've already frisked him",0 |
115 | 120 | _gTextErrorInappropriate .byt "Probably inappropriate",0 |
116 | 121 | _gTextErrorDeadDontMove .byt "Dead don't move",0 |
122 | +_gTextErrorNothingSpecial .byt "Nothing special",0 | |
117 | 123 | #endif |
118 | 124 | _EndErrorMessages |
119 | 125 |
@@ -826,6 +832,54 @@ | ||
826 | 832 | END |
827 | 833 | _EndSceneScripts |
828 | 834 | |
835 | + | |
836 | +// Scene actions | |
837 | +_StartSceneActions | |
838 | + | |
839 | +_gSceneActionReadNewsPaper | |
840 | + .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_NEWSPAPER,"The Daily Telegraph, September 29th",0 | |
841 | + .byt COMMAND_INFO_MESSAGE,"I have to find her fast...",0 | |
842 | + WAIT(50*2) | |
843 | + .byt COMMAND_INFO_MESSAGE,"...I hope she is fine!",0 | |
844 | + WAIT(50*2) | |
845 | + END | |
846 | + | |
847 | +_gSceneActionReadPrintedNote | |
848 | + .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_HANDWRITTEN_NOTE,"A hand written note",0 | |
849 | + WAIT(50*2) | |
850 | + .byt COMMAND_INFO_MESSAGE,"That could be useful...",0 | |
851 | + WAIT(50*2) | |
852 | + .byt COMMAND_INFO_MESSAGE,"...if I can access it!",0 | |
853 | + WAIT(50*2) | |
854 | + END | |
855 | + | |
856 | +_gSceneActionReadChemistryRecipes | |
857 | + .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_CHEMISTRY_RECIPES,"A few useful recipes",0 | |
858 | + WAIT(50*2) | |
859 | + .byt COMMAND_INFO_MESSAGE,"I can definitely use these...",0 | |
860 | + WAIT(50*2) | |
861 | + .byt COMMAND_INFO_MESSAGE,"...just need to find the materials.",0 | |
862 | + WAIT(50*2) | |
863 | + END | |
864 | + | |
865 | +_gSceneActionReadChemistryBook | |
866 | + .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_SCIENCE_BOOK,"A science book",0 | |
867 | + WAIT(50*2) | |
868 | + .byt COMMAND_INFO_MESSAGE,"I don't understand much...",0 | |
869 | + WAIT(50*2) | |
870 | + .byt COMMAND_INFO_MESSAGE,"...but looks like someone took notes.",0 | |
871 | + WAIT(50*2) | |
872 | + END | |
873 | + | |
874 | +_gSceneActionInspectMap | |
875 | + .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_UK_MAP,"A map of the United Kingdom",0 | |
876 | + .byt COMMAND_INFO_MESSAGE,"It shows Ireland, Wales and England",0 | |
877 | + WAIT(50*2) | |
878 | + END | |
879 | + | |
880 | +_EndSceneActions | |
881 | + | |
882 | + | |
829 | 883 | _EndGameTextData |
830 | 884 | |
831 | 885 | ; |
@@ -837,4 +891,6 @@ | ||
837 | 891 | #print - Location names = (_EndLocationNames - _StartLocationNames) |
838 | 892 | #print - Item names = (_EndItemNames - _StartItemNames) |
839 | 893 | #print - Scene scripts = (_EndSceneScripts - _StartSceneScripts) |
894 | +#print - Scene actions = (_EndSceneActions - _StartSceneActions) | |
840 | 895 | |
896 | + |
@@ -70,6 +70,8 @@ | ||
70 | 70 | #define COMMAND_JUMP 8 // Really, that's a GOTO :p |
71 | 71 | #define COMMAND_JUMP_IF_TRUE 9 |
72 | 72 | #define COMMAND_JUMP_IF_FALSE 10 |
73 | +#define COMMAND_INFO_MESSAGE 11 | |
74 | +#define COMMAND_FULLSCREEN_ITEM 12 | |
73 | 75 | |
74 | 76 | // Operator opcodes |
75 | 77 | #define OPERATOR_CHECK_ITEM_LOCATION 0 |