User house validation

This commit is contained in:
elasota
2021-04-25 22:08:15 -04:00
parent 19b1a307e7
commit 0385c28002
18 changed files with 1528 additions and 52 deletions

View File

@@ -0,0 +1,26 @@
A never-before-seen error has arisen. Proceed with caution! (Save and Quit immediately.)
I failed to open the house's resource fork. Any unique room backgrounds are not accessible.
I failed to add a resource to the house's resource fork. See error number.
I failed to create a new resource fork for the house. See error number for problem.
There are no houses on this drive! About your only option is to create your own new house with the Editor.
This house is incompatible with us! You'll need to upgrade Glider PRO to use this house. Do not attempt to play/edit this house!
The background specified by this room was not found! Try re-selecting a new background (the Room Info menu).
The room number is out of bounds. I suspect the house file is corrupt. Try deleting this "illegal" room though.
The data is missing that specifies where the openings in this room are. The house may be damaged. Try selecting a new background though.
There was a problem with the clipboard (Cut, Copy and Paste commands). I couldn't guess why.
I think we just ran out of memory. Quit now and give Glider PRO<52> more memory.
We failed to write the house to disk. (That shouldn't have happened.)
Well, the music didn't load. Glider PRO<52> will still run, you'll just be musically challenged.
Wow, there was a problem bringing sounds up. You might try giving Glider PRO<52> more memory - otherwise ... silence.
Some kind of strange Apple Event error. I think I would just ignore it. Or call Casady & Greene with the error number.
Did you save the house on the same volume Glider PRO is on? I saved the house but had to re-open the old house because I couldn't find the new one.
Wow, I couldn't find the old or new house. Go to the Select House menu item and see if it's there. If not, make sure they're on the same volume as Glider PRO.
Couldn't create a saved game structure. Memory is probably too low.
The saved game doesn't match the house. Either this game was saved for a different house or the house was modified recently.
This saved game is an old version. We cannot use this game with this house.
The number of rooms saved doesn't match the number of house rooms. We cannot use this game with this house.
The QuickTime<6D> movie that goes with this house will not be used. Glider PRO<52> must have enough memory to easily load the entire movie into RAM.
This house has no rooms! Do not attempt to play this house! Select a new house to play.
There was an error generating or parsing a links list. Memory may be tight.
This house contains invalid data that couldn't be repaired. Select a new house to play.
This house contained invalid data, which was repaired. Some things may be missing or not work correctly.

View File

@@ -37,7 +37,8 @@
"LICS/1003.txt" : "ApplicationResourcePatches/LICS/1003.txt",
"LICS/1004.txt" : "ApplicationResourcePatches/LICS/1004.txt",
"LICS/1005.txt" : "ApplicationResourcePatches/LICS/1005.txt",
"LICS/1006.txt" : "ApplicationResourcePatches/LICS/1006.txt"
"LICS/1006.txt" : "ApplicationResourcePatches/LICS/1006.txt",
"STR$23/1006.txt" : "ApplicationResourcePatches/STR/1006.txt"
},
"delete" :
[

View File

@@ -39,6 +39,8 @@
#define kYellowQTMovieNotLoaded 22
#define kYellowNoRooms 23
#define kYellowCantOrderLinks 24
#define kYellowHouseDamaged 25
#define kYellowHouseRepaired 26
#define kSwitchIfNeeded 0
@@ -261,6 +263,8 @@
#define kMaxStars 4
#define kMaxShredded 4
#define kMaxDynamicObs 18
#define kMaxSoundTriggers 1
#define kMaxStairs 1
#define kMaxMasterObjects 216 // kMaxRoomObs * 9
#define kMaxViewWidth 1536
#define kMaxViewHeight (kTileHigh*3+20)
@@ -626,3 +630,13 @@ static const Boolean kFaceLeft = FALSE; // Conflicts with GP input driver
#define kBBQCoalsComponent 1
#define kPendulumComponent 1
#define kStarComponent 1
#define kMapGroundValue 56
#define kUpwardVentMinY 36
#define kMouseholeBottom 295
#define kFireplaceBottom 297
#define kManholeSits 322
#define kGrecoVentTop 303
#define kSewerBlowerTop 292

View File

@@ -9,6 +9,7 @@
#include "GliderStructs.h"
struct GpMouseInputEvent;
struct houseType;
//-------------------------------------------------------------- Prototypes
@@ -124,7 +125,7 @@ void DoHouseInfo (void); // --- HouseInfo.c
Boolean OpenHouse (Boolean load); // --- HouseIO.c
Boolean OpenSpecificHouse (const VFileSpec &);
Boolean SaveHouseAs (void);
Boolean ReadHouse (GpIOStream *houseStream);
Boolean ReadHouse (GpIOStream *houseStream, bool untrusted);
Boolean WriteHouse (Boolean);
Boolean CloseHouse (void);
void OpenHouseResFork (void);
@@ -149,7 +150,7 @@ void GetDemoInput (gliderPtr); // --- Input.c
void GetInput (gliderPtr);
SInt16 MergeFloorSuite (SInt16, SInt16); // --- Link.c
void ExtractFloorSuite (SInt16, SInt16 *, SInt16 *);
void ExtractFloorSuite (const houseType *house, SInt16, SInt16 *, SInt16 *);
void UpdateLinkControl (void);
void UpdateLinkWindow (void);
void OpenLinkWindow (void);
@@ -321,6 +322,7 @@ void DuplicateObject (void);
void MoveObject (SInt16, Boolean);
void DeselectObject (void);
Boolean ObjectHasHandle (SInt16 *, SInt16 *);
Boolean BlowerTypeHasUpperLimit (SInt16);
void HandleBlowerGlider (void);
void SelectNextObject (void);
void SelectPrevObject (void);

View File

@@ -191,7 +191,7 @@ struct houseType
Str255 banner; // 256
Str255 trailer; // 256
scoresType highScores; // 292
gameType savedGame; // 40
gameType savedGame_Unused; // 40
Boolean hasGame; // 1
Boolean unusedBoolean; // 1
int16_t firstRoom; // 2

View File

@@ -385,7 +385,7 @@ void GenerateLinksList (void)
thisObject = thisHousePtr->rooms[r].objects[i];
if (thisObject.data.e.where != -1)
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
roomLinked = GetRoomNumber(floor, suite);
objectLinked = (short)thisObject.data.e.who;
linksList[numLinks].srcRoom = r;
@@ -405,7 +405,7 @@ void GenerateLinksList (void)
thisObject = thisHousePtr->rooms[r].objects[i];
if (thisObject.data.d.where != -1)
{
ExtractFloorSuite(thisObject.data.d.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.d.where, &floor, &suite);
roomLinked = GetRoomNumber(floor, suite);
objectLinked = (short)thisObject.data.d.who;
linksList[numLinks].srcRoom = r;
@@ -597,7 +597,7 @@ void GenerateRetroLinks (void)
thisObject = thisHousePtr->rooms[r].objects[i];
if (thisObject.data.e.where != -1)
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
roomLinked = GetRoomNumber(floor, suite);
if (roomLinked == thisRoomNumber)
{
@@ -620,7 +620,7 @@ void GenerateRetroLinks (void)
thisObject = thisHousePtr->rooms[r].objects[i];
if (thisObject.data.d.where != -1)
{
ExtractFloorSuite(thisObject.data.d.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.d.where, &floor, &suite);
roomLinked = GetRoomNumber(floor, suite);
if (roomLinked == thisRoomNumber)
{
@@ -794,7 +794,7 @@ void ConvertHouseVer1To2 (void)
case kDeluxeTrans:
if (thisRoom->objects[h].data.d.where != -1)
{
ExtractFloorSuite(thisRoom->objects[h].data.d.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisRoom->objects[h].data.d.where, &floor, &suite);
floor += kNumUndergroundFloors;
thisRoom->objects[h].data.d.where = MergeFloorSuite(floor, suite);
}
@@ -810,7 +810,7 @@ void ConvertHouseVer1To2 (void)
case kLgTrigger:
if (thisRoom->objects[h].data.e.where != -1)
{
ExtractFloorSuite(thisRoom->objects[h].data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisRoom->objects[h].data.e.where, &floor, &suite);
floor += kNumUndergroundFloors;
thisRoom->objects[h].data.e.where = MergeFloorSuite(floor, suite);
}

File diff suppressed because it is too large Load Diff

View File

@@ -129,27 +129,17 @@ Boolean KeepObjectLegal (void)
theObject->data.a.topLeft.v = kSewerGrateTop;
theObject->data.a.distance += 2;
}
if ((theObject->what == kFloorTrans) &&
(theObject->data.a.topLeft.v != kFloorTransTop))
{
theObject->data.a.topLeft.v = kFloorTransTop;
theObject->data.a.distance += 2;
}
if (ObjectHasHandle(&direction, &dist))
{
switch (direction)
{
case kAbove:
dist = bounds.top - dist;
if ((theObject->what == kFloorVent) ||
(theObject->what == kFloorBlower) ||
(theObject->what == kTaper) ||
(theObject->what == kCandle) ||
(theObject->what == kStubby))
if (BlowerTypeHasUpperLimit(theObject->what))
{
if (dist < 36)
if (dist < kUpwardVentMinY)
{
theObject->data.a.distance += dist - 36;
theObject->data.a.distance += dist - kUpwardVentMinY;
unchanged = false;
}
}

View File

@@ -42,9 +42,9 @@ short MergeFloorSuite (short floor, short suite)
//-------------------------------------------------------------- ExtractFloorSuite
void ExtractFloorSuite (short combo, short *floor, short *suite)
void ExtractFloorSuite (const houseType *house, SInt16 combo, SInt16 *floor, SInt16 *suite)
{
if ((*thisHouse)->version < 0x0200) // old floor/suite combo
if (house->version < 0x0200) // old floor/suite combo
{
*floor = (combo / 100) - kNumUndergroundFloors;
*suite = combo % 100;

View File

@@ -28,7 +28,6 @@
#define kMapScrollBarWidth 16
#define kHScrollRef 5L
#define kVScrollRef 27L
#define kMapGroundValue 56
#define kNewRoomAlert 1004
#define kYesDoNewRoom 1
#define kThumbnailPictID 1010

View File

@@ -16,13 +16,6 @@
#define kNoMoreObjectsAlert 1008
#define kNoMoreSpecialAlert 1028
#define kMaxSoundTriggers 1
#define kMaxStairs 1
#define kMouseholeBottom 295
#define kFireplaceBottom 297
#define kManholeSits 322
#define kGrecoVentTop 303
#define kSewerBlowerTop 292
short FindEmptyObjectSlot (void);

View File

@@ -534,7 +534,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
room = GetRoomNumber(floor, suite);
obj = (short)thisObject.data.e.who;
DrawLightSwitch(&itsRect, GetObjectState(room, obj));
@@ -547,7 +547,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
room = GetRoomNumber(floor, suite);
obj = (short)thisObject.data.e.who;
DrawMachineSwitch(&itsRect, GetObjectState(room, obj));
@@ -560,7 +560,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
room = GetRoomNumber(floor, suite);
obj = (short)thisObject.data.e.who;
DrawThermostat(&itsRect, GetObjectState(room, obj));
@@ -573,7 +573,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
room = GetRoomNumber(floor, suite);
obj = (short)thisObject.data.e.who;
DrawPowerSwitch(&itsRect, GetObjectState(room, obj));
@@ -586,7 +586,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
ExtractFloorSuite(thisObject.data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisObject.data.e.where, &floor, &suite);
room = GetRoomNumber(floor, suite);
obj = (short)thisObject.data.e.who;
DrawKnifeSwitch(&itsRect, GetObjectState(room, obj));

View File

@@ -1680,6 +1680,24 @@ void DeselectObject (void)
#endif
}
//-------------------------------------------------------------- ObjectHasHandle
Boolean BlowerTypeHasUpperLimit (SInt16 what)
{
switch (what)
{
case kFloorVent:
case kFloorBlower:
case kTaper:
case kCandle:
case kStubby:
return true;
default:
return false;
}
}
//-------------------------------------------------------------- ObjectHasHandle
#ifndef COMPILEDEMO

View File

@@ -1075,7 +1075,7 @@ void DoSwitchObjectInfo (void)
PasStringCopy(PSTR("none"), roomStr);
else
{
ExtractFloorSuite(thisRoom->objects[objActive].data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisRoom->objects[objActive].data.e.where, &floor, &suite);
NumToString((long)floor, roomStr);
PasStringConcat(roomStr, PSTR(" / "));
NumToString((long)suite, tempStr);
@@ -1196,7 +1196,7 @@ void DoTriggerObjectInfo (void)
PasStringCopy(PSTR("none"), roomStr);
else
{
ExtractFloorSuite(thisRoom->objects[objActive].data.e.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisRoom->objects[objActive].data.e.where, &floor, &suite);
NumToString((long)floor, roomStr);
PasStringConcat(roomStr, PSTR(" / "));
NumToString((long)suite, tempStr);
@@ -1869,7 +1869,7 @@ void DoTransObjectInfo (short what)
PasStringCopy(PSTR("none"), roomStr);
else
{
ExtractFloorSuite(thisRoom->objects[objActive].data.d.where, &floor, &suite);
ExtractFloorSuite(*thisHouse, thisRoom->objects[objActive].data.d.where, &floor, &suite);
NumToString((long)floor, roomStr);
PasStringConcat(roomStr, PSTR(" / "));
NumToString((long)suite, tempStr);

View File

@@ -36,6 +36,7 @@ void GetObjectRect (objectPtr who, Rect *itsRect)
switch (who->what)
{
default:
case kObjectIsEmpty:
QSetRect(itsRect, 0, 0, 0, 0);
break;

View File

@@ -136,7 +136,7 @@ short GetRoomLinked (objectType *who)
compoundRoomNumber = who->data.d.where;
if (compoundRoomNumber != -1) // is object linked
{
ExtractFloorSuite(compoundRoomNumber, &floor, &suite);
ExtractFloorSuite(*thisHouse, compoundRoomNumber, &floor, &suite);
whereLinked = GetRoomNumber(floor, suite);
}
else
@@ -154,7 +154,7 @@ short GetRoomLinked (objectType *who)
compoundRoomNumber = who->data.e.where;
if (compoundRoomNumber != -1) // is object linked
{
ExtractFloorSuite(compoundRoomNumber, &floor, &suite);
ExtractFloorSuite(*thisHouse, compoundRoomNumber, &floor, &suite);
whereLinked = GetRoomNumber(floor, suite);
}
else
@@ -352,7 +352,7 @@ void AddTempManholeRect (Rect *manHole)
//-------------------------------------------------------------- SetObjectState
Boolean SetObjectState (short room, short object, short action, short local)
Boolean SetObjectState (SInt16 room, SInt16 object, SInt16 action, SInt16 local)
{
char wasState;
Boolean changed = false;

View File

@@ -31,15 +31,17 @@ void FrameWHRect (DrawSurface *surface, short left, short top, short wide, short
// This function ensures that a rect's top is less than it's bottom<6F>
// and that left is less than right.
void NormalizeRect (Rect *theRect)
Boolean NormalizeRect (Rect *theRect)
{
short tempSide;
Boolean changed = false;
if (theRect->left > theRect->right)
{
tempSide = theRect->left;
theRect->left = theRect->right;
theRect->right = tempSide;
changed = true;
}
if (theRect->top > theRect->bottom)
@@ -47,7 +49,10 @@ void NormalizeRect (Rect *theRect)
tempSide = theRect->top;
theRect->top = theRect->bottom;
theRect->bottom = tempSide;
changed = true;
}
return changed;
}
//-------------------------------------------------------------- ZeroRectCorner
@@ -198,7 +203,8 @@ Boolean ForceRectInRect (Rect *small, Rect *large)
changed = false;
NormalizeRect(small);
if (NormalizeRect(small))
changed = true;
if ((small->bottom - small->top) > (large->bottom - large->top))
{

View File

@@ -17,7 +17,7 @@ namespace PortabilityLayer
void FrameWHRect (short, short, short, short, PortabilityLayer::ResolveCachingColor &color);
void NormalizeRect (Rect *);
Boolean NormalizeRect (Rect *);
void ZeroRectCorner (Rect *);
void CenterRectOnPoint (Rect *, Point);
short HalfRectWide (Rect *);