// Display // // Version Date Author Description // -------------------------------------------------------------------------- // 0.01 24/06/01 BWW Initial implementation #include #include "planner.h" #include "funcprototypes.h" extern Agent_Struct Agent; extern Key_Struct Key; extern Start_Struct Start; extern Exit_Struct Exit; extern Door_Struct Door[]; extern Bridge_Struct Bridge[]; extern Route_Struct Route; extern SearchGoalNodes_Struct SearchGoalNodes; extern Plan_Struct Plan; extern ActionEffects_Struct ActionEffects; // Standard Text extern char TurnMsg[]; extern char PlanMsg[]; extern char StepMsg[]; extern char NoPlanMsg[]; extern char FailedPlanMsg[]; extern long Turn; extern char RouteMsg[]; extern char GoalMsg[]; extern char NotGoalMsg[]; extern char NoActionMsg[]; extern char MoveToMsg[]; extern char UnlockMsg[]; extern char OpenMsg[]; extern char PickupMsg[]; extern char WaitMsg[]; extern char PlanActionMsg[]; extern char ComplexityLowMsg[]; extern char ComplexityMediumMsg[]; extern char ComplexityHighMsg[]; extern char SpeedLowMsg[]; extern char SpeedMediumMsg[]; extern char SpeedHighMsg[]; extern char StartLocationMsg[]; extern int EnvSpeed; extern int EnvComplexity; extern int EnvStartLocation; extern char Environment[ENV_HEIGHT][ENV_WIDTH]; extern int BRIDGENUM; extern int DOORNUM; // Flag whether to print Debug information extern int Debug; // Sprite structure extern GsSPRITE MessageSprite; // Ordering table variables extern GsOT WorldOT[2]; extern GsOT_TAG OTTags[2][1< 96) && (character < 112)) { // Calculate the offset (x & y) within the sprite for the required character lcharacter = character - 97; spriteu = (lcharacter - ((lcharacter / 8)*8)) * 16; spritev = ((lcharacter / 8) * 16) + 96; } // Check for A to Z if ((character > 64) && (character < 91)) { // Calculate the offset (x & y) within the sprite for the required character lcharacter = character - 65; spriteu = (lcharacter - ((lcharacter / 8)*8)) * 16; spritev = (lcharacter / 8) * 16; } // Check for 0 to 9 if ((character > 47) && (character < 58)) { // Calculate the offset (x & y) within the sprite for the required character lcharacter = character - 48; spriteu = (lcharacter - ((lcharacter / 8)*8)) * 16; spritev = ((lcharacter / 8) * 16) + 64; } // Add the character to the OT MessageSprite.x = XPos; MessageSprite.y = YPos; MessageSprite.u = spriteu; MessageSprite.v = spritev; MessageSprite.scalex = Scale; MessageSprite.scaley = Scale; GsSortSprite(&MessageSprite,&WorldOT[activeBuff],ZPriority); // Move the display position (only a half move for 'i','1' & space if ((character == 32)||(character == 73)||(character == 49)) { XPos += (Offset/2); } else { XPos += Offset; } } } // -------------------------------------------------------------------------- // Display a Number // -------------------------------------------------------------------------- // Description: Display a number on screen // // Parameters: long Number to display // Int X Position // Int Y Position // Short Size scaling factor - 4096 = full size // Int Physical screen offset between each character // Short On screem Z priority // Returns: None void NumberDisplay(long Num, int XPos, int YPos, short Scale, int Offset, short ZPriority) { // Local variables int index, character, lcharacter, spriteu, spritev, digit; char string[11]; strcpy(string, ""); while (Num > 0) { digit = (Num - ((Num / 10) * 10)); if (digit == 0) { strcat(string, "0"); } if (digit == 1) { strcat(string, "1"); } if (digit == 2) { strcat(string, "2"); } if (digit == 3) { strcat(string, "3"); } if (digit == 4) { strcat(string, "4"); } if (digit == 5) { strcat(string, "5"); } if (digit == 6) { strcat(string, "6"); } if (digit == 7) { strcat(string, "7"); } if (digit == 8) { strcat(string, "8"); } if (digit == 9) { strcat(string, "9"); } Num = Num / 10; } strcat(string, "\n"); // printf(string); // printf("Length of string = %d \n",(strlen(string)-1)); // For each character in the string for (index = (strlen(string)-2); index > -1; index--) { // Get the character as an Int character = (int)(string[index]); // Calculate the offset (x & y) within the sprite for the required character lcharacter = character - 48; spriteu = (lcharacter - ((lcharacter / 8)*8)) * 16; spritev = ((lcharacter / 8) * 16) + 64; // printf("A number ..\n"); // Add the character to the OT MessageSprite.x = XPos; MessageSprite.y = YPos; MessageSprite.u = spriteu; MessageSprite.v = spritev; MessageSprite.scalex = Scale; MessageSprite.scaley = Scale; GsSortSprite(&MessageSprite,&WorldOT[activeBuff],ZPriority); // Move the display position (only a half move for 'i','1' & space if (character == 49) { XPos += (Offset/2); } else { XPos += Offset; } } } // -------------------------------------------------------------------------- // Indicate whether Bridges and Doors are accessible // -------------------------------------------------------------------------- // Description: Display a tick or cross on screen to indicate whether each // Bridge or Door is accessible // // Parameters: None // Returns: None void DisplayAccessibility() { char chartoprint[2]; int index; // All of the doors for (index=0;index