• R/O
  • SSH
  • HTTPS

oricsdk: Commit


Commit MetaInfo

Revision1714 (tree)
Zeit2023-10-05 03:35:18
Autordbug

Log Message

Minor code optimizations, free memory increased from 811 to 1053 bytes (+242)

Note: Used LCC65, we pay the price of a LDY #0 on each function call, so a non inlined function call without any parameter passed or returned takes 6 bytes:

ldy #0 // 2 bytes
jsr _PrintScore // 3 bytes
rts // 1 byte

Ändern Zusammenfassung

Diff

--- users/dbug/UpgradeTime/Encounter/FloppyBuilderVersion/code/game_main.c (revision 1713)
+++ users/dbug/UpgradeTime/Encounter/FloppyBuilderVersion/code/game_main.c (revision 1714)
@@ -127,8 +127,7 @@
127127
128128 void PrintSceneDirections()
129129 {
130- location* locationPtr = &gLocations[gCurrentLocation];
131- unsigned char* directions = locationPtr->directions;
130+ unsigned char* directions = gLocations[gCurrentLocation].directions;
132131 int direction;
133132
134133 gFlagDirections = 0;
@@ -189,7 +188,6 @@
189188
190189 void PrintSceneObjects()
191190 {
192- int i;
193191 int itemCount = 0;
194192 int item;
195193
@@ -203,25 +201,16 @@
203201
204202 // Print any item in the location
205203 if (itemCount)
206- {
207- char first=1;
204+ {
205+ const char* ptrMessage=gTextCanSee;
208206 char* ptrScreen=(char*)0xbb80+40*18;
209207 for (item=0;item<e_ITEM_COUNT_;item++)
210208 {
211209 if (gItems[item].location == gCurrentLocation)
212210 {
213- if (first)
214- {
215- // The first item on the screen is shown a bit differently
216- sprintf(ptrScreen+1,"%c%s %s",3,gTextCanSee,gItems[item].description); // "I can see"
217- ptrScreen+=40;
218- first=0;
219- }
220- else
221- {
222- sprintf(ptrScreen+1,"%c%s",3,gItems[item].description);
223- ptrScreen+=40;
224- }
211+ sprintf(ptrScreen+1,"%c%s%s",3,ptrMessage,gItems[item].description); // "I can see"
212+ ptrMessage="";
213+ ptrScreen+=40;
225214 }
226215 }
227216 }
@@ -232,11 +221,6 @@
232221 }
233222
234223
235-void PrintScore()
236-{
237- sprintf((char*)0xbb80+16*40+1,"%c%s%d%c",4,gTextScore,gScore,7); // "Score:"
238-}
239-
240224 WORDS ProcessPlayerNameAnswer()
241225 {
242226 // We accept anything, it's the player name so...
@@ -297,16 +281,15 @@
297281
298282 void PrintSceneInformation()
299283 {
300- location* locationPtr = &gLocations[gCurrentLocation];
301- int messageLength = 0;
302-
303284 // Print the description of the place at the top (centered)
304- PrintTopDescription(locationPtr->description);
285+ PrintTopDescription(gLocations[gCurrentLocation].description);
305286
287+ // The redefined charcters to draw the bottom part of the directional arrows \v/
306288 poke(0xbb80+16*40+16,9); // ALT charset
307289 memcpy((char*)0xbb80+16*40+17,";<=>?@",6);
308290
309- PrintScore();
291+ // Display the score
292+ sprintf((char*)0xbb80+16*40+1,"%c%s%d%c",4,gTextScore,gScore,7); // "Score:"
310293
311294 PrintSceneDirections();
312295
--- users/dbug/UpgradeTime/Encounter/FloppyBuilderVersion/code/game_text.s (revision 1713)
+++ users/dbug/UpgradeTime/Encounter/FloppyBuilderVersion/code/game_text.s (revision 1714)
@@ -16,7 +16,7 @@
1616 #ifdef LANGUAGE_FR
1717 _gTextAskInput .byt "Quels sont vos instructions ?",0
1818 _gTextNothingHere .byt "Il n'y a rien d'important ici",0
19-_gTextCanSee .byt "Je vois",0
19+_gTextCanSee .byt "Je vois ",0
2020 _gTextScore .byt "Score:",0
2121 _gTextHighScoreAskForName .byt "Nouveau top score ! Votre name SVP ?",0
2222 _gTextCarryInWhat .byt "Transporte dans quoi ?",0
@@ -41,7 +41,7 @@
4141 #else
4242 _gTextAskInput .byt "What are you going to do now?",0
4343 _gTextNothingHere .byt "There is nothing of interest here",0
44-_gTextCanSee .byt "I can see",0
44+_gTextCanSee .byt "I can see ",0
4545 _gTextScore .byt "Score:",0
4646 _gTextHighScoreAskForName .byt "New highscore! Your name please?",0
4747 _gTextCarryInWhat .byt "Carry it in what?",0
@@ -851,9 +851,15 @@
851851 _gSceneActionReadHandWrittenNote
852852 .byt COMMAND_FULLSCREEN_ITEM,LOADER_PICTURE_HANDWRITTEN_NOTE,"A hand written note",0
853853 WAIT(50*2)
854+#ifdef LANGUAGE_FR
855+ .byt COMMAND_INFO_MESSAGE,"Ca pourrait être utile...",0
856+ WAIT(50*2)
857+ .byt COMMAND_INFO_MESSAGE,"...si je peux y accéder !",0
858+#else
854859 .byt COMMAND_INFO_MESSAGE,"That could be useful...",0
855860 WAIT(50*2)
856861 .byt COMMAND_INFO_MESSAGE,"...if I can access it!",0
862+#endif
857863 WAIT(50*2)
858864 END
859865
Show on old repository browser