mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-11-29 23:49:30 +00:00
1 line
32 KiB
C
1 line
32 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// ObjectAdd.c
//----------------------------------------------------------------------------
//============================================================================
#include <ToolUtils.h>
#include "Externs.h"
#include "ObjectEdit.h"
#include "RectUtils.h"
#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);
short HowManyCandleObjects (void);
short HowManyTikiObjects (void);
short HowManyBBQObjects (void);
short HowManyCuckooObjects (void);
short HowManyBandsObjects (void);
short HowManyGreaseObjects (void);
short HowManyStarsObjects (void);
short HowManySoundObjects (void);
short HowManyUpStairsObjects (void);
short HowManyDownStairsObjects (void);
short HowManyShredderObjects (void);
short HowManyDynamicObjects (void);
void ShoutNoMoreSpecialObjects (void);
short wasFlower;
//============================================================== Functions
//-------------------------------------------------------------- AddNewObject
Boolean AddNewObject (Point where, short what, Boolean showItNow)
{
KeyMap theseKeys;
Rect srcRect, newRect;
short direction, dist;
Boolean handled, drawWholeRoom;
#ifndef COMPILEDEMO
objActive = FindEmptyObjectSlot();
if (objActive == -1)
{
ShoutNoMoreObjects();
return (false);
}
drawWholeRoom = false;
switch (what)
{
case kFloorVent:
case kFloorBlower:
case kSewerGrate:
case kTaper:
case kCandle:
case kStubby:
case kTiki:
case kBBQ:
case kInvisBlower:
case kGrecoVent:
case kSewerBlower:
case kLiftArea:
if (((what == kTaper) || (what == kCandle) || (what == kStubby)) &&
(HowManyCandleObjects() >= kMaxCandles))
{
ShoutNoMoreSpecialObjects();
return (false);
}
else if ((what == kTiki) && (HowManyTikiObjects() >= kMaxTikis))
{
ShoutNoMoreSpecialObjects();
return (false);
}
else if ((what == kBBQ) && (HowManyBBQObjects() >= kMaxCoals))
{
ShoutNoMoreSpecialObjects();
return (false);
}
srcRect = srcRects[what];
thisRoom->objects[objActive].data.a.topLeft.h = where.h - HalfRectWide(&srcRect);
QSetRect(&newRect, 0, 0, RectWide(&srcRect), RectTall(&srcRect));
if (what == kFloorVent)
thisRoom->objects[objActive].data.a.topLeft.v = kFloorVentTop;
else if (what == kFloorBlower)
thisRoom->objects[objActive].data.a.topLeft.v = kFloorBlowerTop;
else if ((what == kTaper) || (what == kCandle) || (what == kStubby) ||
(what == kTiki) || (what == kBBQ) || (what == kInvisBlower) ||
(what == kLiftArea))
thisRoom->objects[objActive].data.a.topLeft.v = where.v - HalfRectTall(&srcRect);
else if (what == kGrecoVent)
thisRoom->objects[objActive].data.a.topLeft.v = kGrecoVentTop;
else if (what == kSewerBlower)
thisRoom->objects[objActive].data.a.topLeft.v = kSewerBlowerTop;
QOffsetRect(&newRect, thisRoom->objects[objActive].data.a.topLeft.h,
thisRoom->objects[objActive].data.a.topLeft.v);
thisRoom->objects[objActive].data.a.distance = 64;
thisRoom->objects[objActive].data.a.initial = true;
thisRoom->objects[objActive].data.a.state = true;
thisRoom->objects[objActive].data.a.vector = 0x01;
if (what == kLiftArea)
thisRoom->objects[objActive].data.a.tall = 0x10;
else
thisRoom->objects[objActive].data.a.tall = 0x00;
break;
case kCeilingVent:
case kCeilingBlower:
srcRect = srcRects[what];
thisRoom->objects[objActive].data.a.topLeft.h = where.h - HalfRectWide(&srcRect);
QSetRect(&newRect, 0, 0, RectWide(&srcRect), RectTall(&srcRect));
if (what == kCeilingVent)
thisRoom->objects[objActive].data.a.topLeft.v = kCeilingVentTop;
else if (what == kCeilingBlower)
thisRoom->objects[objActive].data.a.topLeft.v = kCeilingBlowerTop;
|