LoD_PRC8/_module/nss/shp_include.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

1501 lines
36 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Shape maker and letters of fire
//:: shp_include
//::
//:://////////////////////////////////////////////
/*
This file contains all the functions necessary to create
shapes
*/
//:://////////////////////////////////////////////
//:: Created By: Craig Graff
//:: Created On: 7/15/02 - 8/15/02 (give me a break.. it's my first script ever.)
//:://////////////////////////////////////////////
//-------------variables & constants------------------------//
int nDensity = 4; //use with arcIncrement to modify population of circle or letter
int nNumber = 8; // default number of objects to create
int nPart; //current position along segment
//use if target is an object
object oTarget = OBJECT_SELF;
//blueprint tag of object to create
string sBluePrint= "fireletter";
//Location of target (epicenter)
location lTarget = GetLocation ( oTarget );
location lCreate; //Location of created object
vector vCreate; //position of created object
//vector (position) of lTarget
vector vTarget = GetPositionFromLocation ( lTarget );
//default starting vector for segment
vector vStartSegment = Vector(vTarget.x - 5.0f, vTarget.y + 5.0f, vTarget.z);
//default ending vector for segment
vector vEndSegment = Vector(vTarget.x + 5.0f, vTarget.y + 5.0f, vTarget.z);
//for scaling letters or shapes
float fScale = 1.0f;
float fXScale = 1.0f;
float fYScale = 1.0f;
float fZScale = 1.0f;
float fFace; //Facing of created object
float fRadius = 5.0f; //default radius of circle
//distance from vTarget
float fXDist;
float fYDist;
float fZDist;
//additional distance from vTarget (for use in placement of shapes relative to one another)
float fXOffset;
float fYOffset;
float fZOffset;
//relative coordinates for start of segment
float fX1;
float fY1;
float fZ1;
//relative coordinates for end of segment
float fX2;
float fY2;
float fZ2;
float fAngle; // 0.0f < fAngle <= 360.0f
float fSlice; // degree of seperation between arc objects
//float fDelay = 7.0; //not currently in use
string sCreateType = "PLACEABLE";
int nDuration = DURATION_TYPE_INSTANT;
int nEffect = VFX_IMP_PULSE_FIRE;
string sMessage = GetStringUpperCase("Message here");
string sLine;
string sLetterToPrint;
string sLetter;
int nMessageLength;
int bLowerCase;
int nMessageType = 2;
float fSpacing;
//-----------------------------declaring functions---------------------------------------//
//------------base funtions----------------//
//Returns nNumber - makes sure circle is well populated -- not in use at this time
//int arcIncrement(float fRadius);
//Determines x-coordinate for vector
//returns values for fXDist
float arcCreateX(float fAngle, float fRadius);
//Determines y-coordinate for vector
//Arc function - returns values for fYDist
float arcCreateY(float fAngle, float fRadius);
//Determines z-coordinate for vector
//Arc function - returns values for fZDist
float arcCreateZ(float fAngle, float fRadius);
//Arc function - compute angle for sin & cos
float ArcComputeAngle(float fAngle);
//returns facing of created object
//returns fFace
float arcFacing(float fAngle);
//Determines x-coordinate for vector along segment
//returns values for fXDist
float createX(int nNumber);
//Determines y-coordinate for vector along segment
//returns values for fYDist
float createY(int nNumber);
//Determines z-coordinate for vector along segment
//returns values for fZDist
float createZ(int nNumber);
//Arc function - returns lCreate
location arcCreateLocation(float fAngle);
//Arc function - returns vCreate
vector arcCreateSpot(float fAngle);
//returns vCreate
vector createSpot(int nNumber);
//Creates object or effect named in sBlueprint or nEffect
//at fAngle
void arcCreateBluePrint(float fAngle);
//Creates object or effect named in sBlueprint or nEffect
void createBluePrint(int nNumber);
//returns location to create object
location createLocation(int nNumber);
//defines the starting point for a segment using coordinates fX1, fY1, and fZ1
vector startSegment(float fX1, float fY1, float fZ1);
//defines the end point for a segment using coordinates fX2, fY2, and fZ2
vector endSegment(float fX2, float fY2, float fZ2);
// destroys all the designated instances of sBlueprint
void destroy(string sBlueprint);
//-------functions for shapes--------------//
//
// most of these will likely be integrated into one function for later releases
//
// Creates a cirle of nNumber of objects with resref sBlueprint, with fRadius
void circle(int nNumber, float fRadius);
// Creates a hoop of nNumber of objects with resref sBlueprint, with fRadius
void hoop(int nNumber, float fRadius);
// Creates a topHalfCircle of nNumber of objects with resref sBlueprint, with fRadius
void topHalfCircle(int nNumber, float fRadius);
// Creates a bottomHalfCircle of nNumber of objects with resref sBlueprint, with fRadius
void bottomHalfCircle(int nNumber, float fRadius);
// Creates a leftHalfCircle of nNumber of objects with resref sBlueprint, with fRadius
void leftHalfCircle(int nNumber, float fRadius);
// Creates a rightHalfCircle of nNumber of objects with resref sBlueprint, with fRadius
void rightHalfCircle(int nNumber, float fRadius);
// Creates a topArch of nNumber of objects with resref sBlueprint, with fRadius
void topArch(int nNumber, float fRadius);
// Creates a bottomArch of nNumber of objects with resref sBlueprint, with fRadius
void bottomArch(int nNumber, float fRadius);
// Creates a topLeftHalfArch of nNumber of objects with resref sBlueprint, with fRadius
void topLeftHalfArch(int nNumber, float fRadius);
// Creates a topRightHalfArch of nNumber of objects with resref sBlueprint, with fRadius
void topRightHalfArch(int nNumber, float fRadius);
// Creates a bottomLeftHalfArch of nNumber of objects with resref sBlueprint, with fRadius
void bottomLeftHalfArch(int nNumber, float fRadius);
// Creates a bottomRightHalfArch of nNumber of objects with resref sBlueprint, with fRadius
void bottomRightHalfArch(int nNumber, float fRadius);
// Creates a segment of a line with nNumber of objects from the point
// vStartSegment to vEndSegment. Used in conjunction with startSegment()
// and endSegment()
void doSegment(int nNumber);
//------- functions for letters-----------//
//Creates the letter
void A();
//Creates the letter
void B();
//Creates the letter
void C();
//Creates the letter
void D();
//Creates the letter
void E();
//Creates the letter
void F();
//Creates the letter
void G();
//Creates the letter
void H();
//Creates the letter
void I();
//Creates the letter
void J();
//Creates the letter
void K();
//Creates the letter
void L();
//Creates the letter
void M();
//Creates the letter
void N();
//Creates the letter
void O();
//Creates the letter
void P();
//Creates the letter
void Q();
//Creates the letter
void R();
//Creates the letter
void S();
//Creates the letter
void T();
//Creates the letter
void U();
//Creates the letter
void V();
//Creates the letter
void W();
//Creates the letter
void X();
//Creates the letter
void Y();
//Creates the letter
void Z();
// creates punctuation
void apostrophe();
// creates punctuation
void period();
// creates punctuation
void exclamation();
// creates punctuation
void questionmark();
//--------------funtions for printing----------------//
//prints sLetterToPrint in flames
void printLetter(string sLetterToPrint);
//Prints sLine in letters of fire if nDurationType = DURATION_TYPE_TEMPORARY
//the letters will fade after about 7 seconds
void printLine(string sLine);
//Takes the first 13 characters from sMessage(counts down from 13th character
//until it finds a blank character, prints them in letters
//of fire and returns the rest of sMessage
//
//Note: if any of your words is longer than 13 characters, this function cannot
//continue.
string getLine(string sMessage);
//Uses getLine to break up sMessage into readable chunks and displays these
//chunks in 7 second intervals
void printMessage(string sMessage);
//---------------------defining functions----------------------------------//
/* not in use at this time
int arcIncrement(float fRadius)
{
nNumber = (FloatToInt(0.5f * fRadius * PI) + 1) * nDensity;
return nNumber;
}
*/
float arcCreateX(float fAngle, float fRadius)
{
fXDist = fRadius * cos(fAngle) * fXScale;
return fXDist;
}
float arcCreateY(float fAngle, float fRadius)
{
fYDist = fRadius * sin(fAngle) * fYScale;
return fYDist;
}
float arcCreateZ(float fAngle, float fRadius)
{
fZDist = fRadius * sin(fAngle) * fZScale;
return fZDist;
}
/*
returns vector to compute location to create object
*/
vector arcCreateSpot(float fAngle)
{
vCreate = Vector(vTarget.x + (fXDist + fXOffset), vTarget.y + fYDist
+ fYOffset, vTarget.z + fZDist + fZOffset);
return vCreate;
}
/*
returns location to create object
*/
location arcCreateLocation(float fAngle)
{
lCreate = Location(GetArea(oTarget), arcCreateSpot(fAngle), arcFacing(fAngle));
return lCreate;
}
/*
returns facing of created object
*/
float arcFacing(float fAngle)
{
fFace = fAngle;
while (fFace > 360.0f)
{
fFace = fFace - 360.0f;
}
return fFace;
}
/*
Creates object or effect named in sBlueprint or nEffect
*/
void arcCreateBluePrint(float fAngle)
{
object oCreated;
if (sCreateType == "EFFECT")
{
ApplyEffectAtLocation(nDuration, EffectVisualEffect(nEffect, FALSE), arcCreateLocation(fAngle));
}
else
{
if (sCreateType == "PLACEABLE")
{
oCreated = CreateObject(OBJECT_TYPE_PLACEABLE, sBluePrint, arcCreateLocation(fAngle), FALSE);
}
if (sCreateType == "CREATURE")
{
oCreated = CreateObject(OBJECT_TYPE_CREATURE, sBluePrint, arcCreateLocation(fAngle), FALSE);
}
if (sCreateType == "ITEM")
{
oCreated = CreateObject(OBJECT_TYPE_ITEM, sBluePrint, arcCreateLocation(fAngle), FALSE);
}
if (sCreateType == "STORE")
{
oCreated = CreateObject(OBJECT_TYPE_STORE, sBluePrint, arcCreateLocation(fAngle), FALSE);
}
}
}
location createLocation(int nNumber)
{
lCreate = Location(GetArea(oTarget), createSpot(nNumber), arcFacing(fAngle));
return lCreate;
}
void createBluePrint(int nNumber)
{
if (sCreateType == "EFFECT") //not fully or properly implemented
{
ApplyEffectAtLocation(nDuration, EffectVisualEffect(nEffect, FALSE),
createLocation(nNumber));
}
else
{
if (sCreateType == "PLACEABLE")
{
CreateObject(OBJECT_TYPE_PLACEABLE, sBluePrint, createLocation(nNumber), FALSE);
}
if (sCreateType == "CREATURE")
{
CreateObject(OBJECT_TYPE_CREATURE, sBluePrint, createLocation(nNumber), FALSE);
}
if (sCreateType == "ITEM")
{
CreateObject(OBJECT_TYPE_ITEM, sBluePrint, createLocation(nNumber), FALSE);
}
if (sCreateType == "STORE")//why not...
{
CreateObject(OBJECT_TYPE_STORE, sBluePrint, createLocation(nNumber), FALSE);
}
}
}
vector startSegment(float fX1, float fY1, float fZ1)
{
vStartSegment = Vector(vTarget.x + fX1 * fXScale + fXOffset,
vTarget.y + fY1 * fYScale + fYOffset, vTarget.z + fZ1 * fZScale +fZOffset);
return vStartSegment;
}
vector endSegment(float fX2, float fY2, float fZ2)
{
vEndSegment = Vector(vTarget.x + fX2 * fXScale + fXOffset,
vTarget.y + fY2 * fYScale + fYOffset, vTarget.z + fZ2 * fZScale + fZOffset);
return vEndSegment;
}
vector createSpot(int nNumber)
{
if (nNumber > 0)
{
vCreate = Vector(vStartSegment.x + createX(nNumber),
vStartSegment.y + createY(nNumber),
vStartSegment.z + createZ(nNumber));
}
else
{
vCreate = Vector((vStartSegment.x + vEndSegment.x) / 2,
(vStartSegment.y + vEndSegment.y) / 2,
(vStartSegment.z + vEndSegment.z) / 2);
}
return vCreate;
}
float createX(int nNumber)
{
fXDist = (( vEndSegment.x - vStartSegment.x ) / nNumber) * nPart;
return fXDist;
}
float createY(int nNumber)
{
fYDist = (( vEndSegment.y - vStartSegment.y ) / nNumber) * nPart;
return fYDist;
}
float createZ(int nNumber)
{
fZDist = (( vEndSegment.z - vStartSegment.z ) / nNumber) * nPart;
return fZDist;
}
void destroy(string sBlueprint)
{
int nDestroy = 0;
object oObjectToDestroy = GetObjectByTag(sBluePrint,nDestroy++);
while ( oObjectToDestroy != OBJECT_INVALID)
{
DestroyObject( oObjectToDestroy );
oObjectToDestroy = GetObjectByTag(sBluePrint, nDestroy++);
}
}
//create various types of shapes - almost entirely circles at this point
//future releases will probably combine all of these into one function
//with different inputs
void circle(int nNumber, float fRadius)
{
fSlice = 360.0f / nNumber;
fAngle = 0.0f;
while (fAngle <= 360.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
fAngle = fAngle + fSlice;
arcCreateBluePrint(fAngle);
}
}
void hoop(int nNumber, float fRadius)
{
fSlice = 360.0f / nNumber;
fAngle = 0.0f;
while (fAngle <= 360.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
fAngle = fAngle + fSlice;
arcCreateBluePrint(fAngle);
}
}
void topHalfCircle(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 0.0f;
while (fAngle <= 180.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void bottomHalfCircle(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 180.0f;
while (fAngle <= 360.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void leftHalfCircle(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 90.0f;
while (fAngle <= 270.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void rightHalfCircle(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 270.0f;
while (fAngle <= 450.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void topArch(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 0.0f;
while (fAngle <= 180.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void bottomArch(int nNumber, float fRadius)
{
fSlice = 180.0f / nNumber;
fAngle = 180.0f;
while (fAngle <= 360.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void topLeftHalfArch(int nNumber, float fRadius)
{
fSlice = 90.0f / nNumber;
fAngle = 90.0f;
while (fAngle <= 180.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void topRightHalfArch(int nNumber, float fRadius)
{
fSlice = 90.0f / nNumber;
fAngle = 0.0f;
while (fAngle <= 90.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void bottomRightHalfArch(int nNumber, float fRadius)
{
fSlice = 90.0f / nNumber;
fAngle = 270.0f;
while (fAngle <= 360.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void bottomLeftHalfArch(int nNumber, float fRadius)
{
fSlice = 90.0f / nNumber;
fAngle = 180.0f;
while (fAngle <= 270.0f)
{
arcCreateX(fAngle, fRadius);
arcCreateY(fAngle, fRadius);
arcCreateZ(fAngle, fRadius);
arcCreateBluePrint(fAngle);
fAngle = fAngle + fSlice;
}
}
void doSegment(int nNumber)
{
nPart = 0;
while (nPart <= nNumber)
{
createBluePrint(nNumber);
nPart++;
}
}
//Functions for letters
void A()
{
startSegment(-1.05f, 0.0f, 0.0f);
endSegment(-0.15f, 4.0f, 4.0f);
doSegment(5 * nDensity / 4);
startSegment(1.05f, 0.0f, 0.0f);
endSegment(0.15f, 4.0f, 4.0f);
doSegment(5 * nDensity / 4);
startSegment(-0.225f, 0.8f, 0.8f);
endSegment(0.225f, 0.8f, 0.8f);
doSegment(1);
}
void B()
{
startSegment(-1.05f, 0.0f, 0.0f);
endSegment(-1.05f, 4.0f, 4.0f);
doSegment(8 * nDensity / 4);
startSegment(-0.9f, 4.0f, 4.0f);
endSegment(-0.65f, 4.0f, 4.0f);
doSegment(0);
startSegment(-0.9f, 2.0f, 2.0f);
endSegment(-0.65f, 2.0f, 2.0f);
doSegment(0);
startSegment(-0.9f, 0.0f, 0.0f);
endSegment(-0.4f, 0.0f, 0.0f);
doSegment(1 * nDensity / 4);
fXOffset = fXOffset - 0.15 * fXScale;
fYOffset = fYOffset + 3 * fYScale;
fZOffset = fZOffset + 3 * fZScale;
rightHalfCircle(5 * nDensity / 4, 1.0);
fXOffset = fXOffset + 0.25 * fXScale;
fYOffset = fYOffset - 2.0 * fYScale;
fZOffset = fZOffset - 2.0 * fZScale;
rightHalfCircle(5 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fXOffset = fXOffset - 0.10 * fXScale;
fYOffset = fYOffset - 1.0 * fYScale;
fZOffset = fZOffset - 1.0 * fZScale;
}
void C()
{
fYOffset = fYOffset + 2.0 * fYScale;
fZOffset = fZOffset + 2.0 * fZScale;
leftHalfCircle(11 * nDensity / 4, 2.0);
fYOffset = fYOffset + 1.0 * fYScale;
fZOffset = fZOffset + 1.0 * fZScale;
topRightHalfArch(3 * nDensity / 4, 1.0);
fYOffset = fYOffset - 2.0 * fYScale;
fZOffset = fZOffset - 2.0 * fZScale;
bottomRightHalfArch(3 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fYOffset = fYOffset - 1.0 * fYScale;
fZOffset = fZOffset - 1.0 * fZScale;
}
void D()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(-1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.1, 4.0, 4.0);
endSegment(-0.8, 4.0, 4.0);
doSegment(0 * nDensity / 4);
startSegment(-1.1, 0.0, 0.0);
endSegment(-0.8, 0.0, 0.0);
doSegment(0 * nDensity / 4);
fXOffset = fXOffset - 0.6 * fXScale;
fYOffset = fYOffset + 2.0 * fYScale;
fZOffset = fZOffset + 2.0 * fZScale;
rightHalfCircle(10 * nDensity / 4, 2.0);
//restoring offsets to relative zero values
fXOffset = fXOffset + 0.6 * fXScale;
fYOffset = fYOffset - 2.0 * fYScale;
fZOffset = fZOffset - 2.0 * fZScale;
}
void E()
{
startSegment(-1.4, 0.0, 0.0);
endSegment(-1.4, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.0, 4.0, 4.0);
endSegment(1.2, 4.0, 4.0);
doSegment(4 * nDensity / 4);
startSegment(-1.0, 2.0, 2.0);
endSegment(0.0, 2.0, 2.0);
doSegment(2 * nDensity / 4);
startSegment(-1.0, 0.0, 0.0);
endSegment(1.2, 0.0, 0.0);
doSegment(4 * nDensity / 4);
}
void F()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(-1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-0.8, 4.0, 4.0);
endSegment(1.3, 4.0, 4.0);
doSegment(4 * nDensity / 4);
startSegment(-0.8, 2.0, 2.0);
endSegment(0.1, 2.0, 2.0);
doSegment(2 * nDensity / 4);
}
void G()
{
fYOffset = fYOffset + 2.0 * fYScale;
fZOffset = fZOffset + 2.0 * fZScale;
leftHalfCircle(11 * nDensity / 4, 2.0);
fYOffset = fYOffset + 1.0 * fYScale;
fZOffset = fZOffset + 1.0 * fZScale;
topRightHalfArch(3 * nDensity / 4, 1.0);
fYOffset = fYOffset - 2.0 * fYScale;
fZOffset = fZOffset - 2.0 * fZScale;
bottomRightHalfArch(3 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fYOffset = fYOffset - 1.0 * fYScale;
fZOffset = fZOffset - 1.0 * fZScale;
startSegment(0.0, 1.5, 1.5);
endSegment(1.0, 1.5, 1.5);
doSegment(2 * nDensity / 4);
}
void H()
{
startSegment(-1.4, 0.0, 0.0);
endSegment(-1.4, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.0, 2.0, 2.0);
endSegment(1.0, 2.0, 2.0);
doSegment(4 * nDensity / 4);
startSegment(1.4, 0.0, 0.0);
endSegment(1.4, 4.0, 4.0);
doSegment(8 * nDensity / 4);
}
void I()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.2, 4.0, 4.0);
endSegment(1.2, 4.0, 4.0);
doSegment(4 * nDensity / 4);
startSegment(-1.2, 0.0, 0.0);
endSegment(1.2, 0.0, 0.0);
doSegment(4 * nDensity / 4);
}
void J()
{
startSegment(1.0, 1.25, 1.25);
endSegment(1.0, 4.0, 4.0);
doSegment(6 * nDensity / 4);
fXOffset = fXOffset - 0.25 * fXScale;
fYOffset = fYOffset + 1.25 * fYScale;
fZOffset = fZOffset + 1.25 * fZScale;
bottomHalfCircle(6 * nDensity / 4, 1.25);
//restoring offsets to relative zero values
fXOffset = fXOffset + 0.25 * fXScale;
fYOffset = fYOffset - 1.25 * fYScale;
fZOffset = fZOffset - 1.25 * fZScale;
}
void K()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(-1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.3, 2.0, 2.0);
endSegment(1.3, 4.0, 4.0);
doSegment(5 * nDensity / 4);
startSegment(-1.3, 2.0, 2.0);
endSegment(1.3, 0.0, 0.0);
doSegment(5 * nDensity / 4);
}
void L()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(-1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-0.9, 0.0, 0.0);
endSegment(1.3, 0.0, 0.0);
doSegment(4 * nDensity / 4);
}
void M()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(-1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(1.3, 0.0, 0.0);
endSegment(1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.1, 4.0, 4.0);
endSegment(0.0, 2.0, 2.0);
doSegment(4 * nDensity / 4);
startSegment(0.0, 2.0, 2.0);
endSegment(1.1, 4.0, 4.0);
doSegment(4 * nDensity / 4);
}
void N()
{
startSegment(-1.1, 0.0, 0.0);
endSegment(-1.1, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.1, 4.0, 4.0);
endSegment(1.1, 0.0, 0.0);
doSegment(8 * nDensity / 4);
startSegment(1.1, 0.0, 0.0);
endSegment(1.1, 4.0, 4.0);
doSegment(8 * nDensity / 4);
}
void O()
{
startSegment(-1.3f, 1.6f, 1.6f);
endSegment(1.3f, 1.6, 1.6f);
doSegment(1);
startSegment(-1.3f, 2.0f, 2.0f);
endSegment(1.3f, 2.0f, 2.0f);
doSegment(1);
startSegment(-1.3f, 2.4f, 2.4f);
endSegment(1.3f, 2.4f, 2.4f);
doSegment(1);
fYOffset = fYOffset + 1.3f * fYScale;
fZOffset = fZOffset + 1.3f * fZScale;
bottomHalfCircle(10 * nDensity / 4, 1.3);//);
fYOffset = fYOffset + 1.4f * fYScale;
fZOffset = fZOffset + 1.4f * fZScale;
topHalfCircle(10 * nDensity / 4, 1.3);//);
//restoring offsets to relative zero values
fYOffset = fYOffset - 2.7f * fYScale;
fZOffset = fZOffset - 2.7f * fZScale;
}
void P()
{
startSegment(-1.4, 0.0, 0.0);
endSegment(-1.4, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-0.9, 4.0, 4.0);
endSegment(-0.65, 4.0, 4.0);
doSegment(0 * nDensity / 4);
startSegment(-0.9, 2.0, 2.0);
endSegment(-0.65, 2.0, 2.0);
doSegment(0 * nDensity / 4);
fXOffset = fXOffset - 0.15 * fXScale;
fYOffset = fYOffset + 3.0 * fYScale;
fZOffset = fZOffset + 3.0 * fZScale;
rightHalfCircle(5 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fXOffset = fXOffset + 0.15 * fXScale;
fYOffset = fYOffset - 3.0 * fYScale;
fZOffset = fZOffset - 3.0 * fZScale;
}
void Q()
{
startSegment(-1.2, 1.6, 1.6);
endSegment(1.2, 1.6, 1.6);
doSegment(1);
startSegment(-1.2, 2.0, 2.0);
endSegment(1.2, 2.0, 2.0);
doSegment(1);
startSegment(-1.2, 2.4, 2.4);
endSegment(1.2, 2.4, 2.4);
doSegment(1);
startSegment(0.2, 1.1, 1.1);
endSegment(1.2, 0.0, 0.0);
doSegment(3 * nDensity / 4);
fYOffset = fYOffset + 1.3 * fYScale;
fZOffset = fZOffset + 1.3 * fZScale;
bottomHalfCircle(10 * nDensity / 4, 1.3);
fYOffset = fYOffset + 1.4 * fYScale;
fZOffset = fZOffset + 1.4 * fZScale;
topHalfCircle(10 * nDensity / 4, 1.3);
//restoring offsets to relative zero values
fYOffset = fYOffset - 2.7 * fYScale;
fZOffset = fZOffset - 2.7 * fZScale;
}
void R()
{
startSegment(-1.4, 0.0, 0.0);
endSegment(-1.4, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-0.9, 4.0, 4.0);
endSegment(-0.65, 4.0, 4.0);
doSegment(0);
startSegment(-0.9, 2.0, 2.0);
endSegment(-0.65, 2.0, 2.0);
doSegment(0);
startSegment(-0.9, 2.0, 2.0);
endSegment(0.85, 0.0, 0.0);
doSegment(3 * nDensity);
fXOffset = fXOffset - 0.15 * fXScale;
fYOffset = fYOffset + 3.0 * fYScale;
fZOffset = fZOffset + 3.0 * fZScale;
rightHalfCircle(5 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fXOffset = fXOffset + 0.15 * fXScale;
fYOffset = fYOffset - 3.0 * fYScale;
fZOffset = fZOffset - 3.0 * fZScale;
}
void S()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 4.0, 4.0);
doSegment(2);
fXOffset = fXOffset - 0.5 * fXScale;
fYOffset = fYOffset + 3.0 * fYScale;
fZOffset = fZOffset + 3.0 * fZScale;
leftHalfCircle(6 * nDensity / 4, 1.0);
fXOffset = fXOffset + 1.0 * fXScale;
topRightHalfArch(3 * nDensity / 4, 1.0);
fYOffset = fYOffset - 2.0 * fYScale;
fZOffset = fZOffset - 2.0 * fZScale;
rightHalfCircle(6 * nDensity / 4, 1.0);
fXOffset = fXOffset - 1.0 * fXScale;
bottomLeftHalfArch(3 * nDensity / 4, 1.0);
//restoring offsets to relative zero values
fXOffset = fXOffset + 0.5 * fXScale;
fYOffset = fYOffset - 1.0 * fYScale;
fZOffset = fZOffset - 1.0 * fZScale;
}
void T()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.3, 4.0, 4.0);
endSegment(1.3, 4.0, 4.0);
doSegment(6 * nDensity / 4);
}
void U()
{
startSegment(1.25, 1.25, 1.25);
endSegment(1.25, 4.0, 4.0);
doSegment(6 * nDensity / 4);
startSegment(-1.25, 1.25, 1.25);
endSegment(-1.25, 4.0, 4.0);
doSegment(6 * nDensity / 4);
fYOffset = fYOffset + 1.25 * fYScale;
fZOffset = fZOffset + 1.25 * fZScale;
bottomHalfCircle(6 * nDensity / 4, 1.25);
//restoring offsets to relative zero values
fYOffset = fYOffset - 1.25 * fYScale;
fZOffset = fZOffset - 1.25 * fZScale;
}
void V()
{
startSegment(-1.2, 4.0, 4.0);
endSegment(0.0, 0.0, 0.0);
doSegment(8 * nDensity / 4);
startSegment(1.2, 4.0, 4.0);
endSegment(0.0, 0.0, 0.0);
doSegment(8 * nDensity / 4);
}
void W()
{
startSegment(-1.4, 4.0, 4.0);
endSegment(-0.7, 0.0, 0.0);
doSegment(6 * nDensity / 4);
startSegment(-0.7, 0.0, 0.0);
endSegment(0.0, 2.0, 2.0);
doSegment(3 * nDensity / 4);
startSegment(0.0, 2.0, 2.0);
endSegment(0.7, 0.0, 0.0);
doSegment(3 * nDensity / 4);
startSegment(1.4, 4.0, 4.0);
endSegment(0.7, 0.0, 0.0);
doSegment(6 * nDensity / 4);
}
void X()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.3, 4.0, 4.0);
endSegment(1.3, 0.0, 0.0);
doSegment(8 * nDensity / 4);
}
void Y()
{
startSegment(-1.3, 4.0, 4.0);
endSegment(0.0, 2.0, 2.0);
doSegment(4 * nDensity / 4);
startSegment(0.0, 2.0, 2.0);
endSegment(1.3, 4.0, 4.0);
doSegment(4 * nDensity / 4);
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 2.0, 2.0);
doSegment(4 * nDensity / 4);
}
void Z()
{
startSegment(-1.3, 0.0, 0.0);
endSegment(1.3, 4.0, 4.0);
doSegment(8 * nDensity / 4);
startSegment(-1.3, 4.0, 4.0);
endSegment(1.3, 4.0, 4.0);
doSegment(6 * nDensity / 4);
startSegment(-1.3, 0.0, 0.0);
endSegment(1.3, 0.0, 0.0);
doSegment(6 * nDensity / 4);
}
void apostrophe()
{
startSegment(0.0, 3.8, 3.8);
endSegment(0.8, 3.0, 3.0);
doSegment(2);
}
void period()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 0.0, 0.0);
doSegment(0);
}
void exclamation()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 0.0, 0.0);
doSegment(0);
startSegment(0.0, 1.0, 1.0);
endSegment(0.0, 4.0, 4.0);
doSegment(7 * nDensity / 4);
}
void questionmark()
{
startSegment(0.0, 0.0, 0.0);
endSegment(0.0, 0.0, 0.0);
doSegment(0);
startSegment(0.0, 1.0, 1.0);
endSegment(0.0, 2.0, 2.0);
doSegment(3 * nDensity / 4);
fYOffset = fYOffset + 3.0 * fYScale;
fZOffset = fZOffset + 3.0 * fZScale;
rightHalfCircle(8 * nDensity / 4, 1.0);
fYOffset = fYOffset + 0.5 * fYScale;
fZOffset = fZOffset + 0.5 * fZScale;
topLeftHalfArch(4 * nDensity / 4, 0.5);
//restoring offsets to relative zero values
fYOffset = fYOffset - 3.5 * fYScale;
fZOffset = fZOffset - 3.5 * fZScale;
}
void printLetter(string sLetterToPrint)
{
if (sLetterToPrint == " ")
{
fXOffset = fXOffset + 3.2 * fXScale;
}
else
{
if (bLowerCase != 1)
{
if (sLetterToPrint != GetStringUpperCase(sLetterToPrint))
{
fXScale = 2 * fXScale / 3;
fYScale = 2 * fYScale / 3;
fZScale = 2 * fZScale / 3;
nDensity = 3;
bLowerCase = 1;
}
}
else
{
if (sLetterToPrint == GetStringUpperCase(sLetterToPrint))
{
fXScale = 3 * fXScale / 2;
fYScale = 3 * fYScale / 2;
fZScale = 3 * fZScale / 2;
nDensity = 4;
bLowerCase = 0;
}
}
if (sLetterToPrint == "'")
{
fXOffset = fXOffset + 2.2 * fXScale;
apostrophe();
fXOffset = fXOffset + 0.8 * fXScale;
}
else if (sLetterToPrint == "!")
{
fXOffset = fXOffset + 2.2 * fXScale;
exclamation();
fXOffset = fXOffset + 1.4 * fXScale;
}
else if (sLetterToPrint == ".")
{
fXOffset = fXOffset + 2.2 * fXScale;
period();
fXOffset = fXOffset + 1.4 * fXScale;
}
else
{
fXOffset = fXOffset + 3.6 * fXScale;
if (bLowerCase != 1)
{
if (sLetterToPrint != GetStringUpperCase(sLetterToPrint))
{
fXScale = 2 * fXScale / 4;
fYScale = 2 * fYScale / 4;
fZScale = 2 * fZScale / 4;
nDensity = 3;
bLowerCase = 1;
}
}
else
{
if (sLetterToPrint == GetStringUpperCase(sLetterToPrint))
{
fXScale = 3 * fXScale / 2;
fYScale = 3 * fYScale / 2;
fZScale = 3 * fZScale / 2;
nDensity = 4;
bLowerCase = 0;
}
}
if (GetStringUpperCase(sLetterToPrint) == "A")
{
A();
}
if (GetStringUpperCase(sLetterToPrint) == "B")
{
B();
}
if (GetStringUpperCase(sLetterToPrint) == "C")
{
C();
}
if (GetStringUpperCase(sLetterToPrint) == "D")
{
D();
}
if (GetStringUpperCase(sLetterToPrint) == "E")
{
E();
}
if (GetStringUpperCase(sLetterToPrint) == "F")
{
F();
}
if (GetStringUpperCase(sLetterToPrint) == "G")
{
G();
}
if (GetStringUpperCase(sLetterToPrint) == "H")
{
H();
}
if (GetStringUpperCase(sLetterToPrint) == "I")
{
I();
}
if (GetStringUpperCase(sLetterToPrint) == "J")
{
J();
}
if (GetStringUpperCase(sLetterToPrint) == "K")
{
K();
}
if (GetStringUpperCase(sLetterToPrint) == "L")
{
L();
}
if (GetStringUpperCase(sLetterToPrint) == "M")
{
M();
}
if (GetStringUpperCase(sLetterToPrint) == "N")
{
N();
}
if (GetStringUpperCase(sLetterToPrint) == "O")
{
O();
}
if (GetStringUpperCase(sLetterToPrint) == "P")
{
P();
}
if (GetStringUpperCase(sLetterToPrint) == "Q")
{
Q();
}
if (GetStringUpperCase(sLetterToPrint) == "R")
{
R();
}
if (GetStringUpperCase(sLetterToPrint) == "S")
{
S();
}
if (GetStringUpperCase(sLetterToPrint) == "T")
{
T();
}
if (GetStringUpperCase(sLetterToPrint) == "U")
{
U();
}
if (GetStringUpperCase(sLetterToPrint) == "V")
{
V();
}
if (GetStringUpperCase(sLetterToPrint) == "W")
{
W();
}
if (GetStringUpperCase(sLetterToPrint) == "X")
{
X();
}
if (GetStringUpperCase(sLetterToPrint) == "Y")
{
Y();
}
if (GetStringUpperCase(sLetterToPrint) == "Z")
{
Z();
}
if (sLetterToPrint == "?")
{
questionmark();
}
}
}
}
void printLine(string sLine)
{
ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_FNF_FIRESTORM), lTarget);
int nLineLength = GetStringLength(sLine);
if (nMessageType = 1) //all lower case
{
fSpacing = (2.6 * fXScale) * nLineLength / 2;
}
if (nMessageType = 2) //all upper case
{
fSpacing = (3.6 * fXScale) * nLineLength / 2;
}
if (nMessageType = 3) //mixed - upper and lower case
{
fSpacing = (3.0 * fXScale) * nLineLength / 2;
}
fXOffset = fXOffset - fSpacing;
int nLetter = 0;
while (nLetter < nLineLength)
{
sLetterToPrint = GetSubString(sLine, nLetter, 1);
printLetter(sLetterToPrint);
nLetter++;
}
fXOffset = fXOffset + fSpacing;
if ( nDuration == DURATION_TYPE_TEMPORARY)
{
DelayCommand(7.0, destroy(sBluePrint));
}
}
void printMessage(string sMessage)
{
nDuration = DURATION_TYPE_TEMPORARY;
nMessageLength = GetStringLength(sMessage);
if (nMessageLength > 12)
{
while (nMessageLength > 12)
{
sMessage = getLine(sMessage);
nMessageLength = GetStringLength(sMessage);
if ( nMessageLength <= 12)
{
if (nMessageLength == -1)
break;
else
ActionDoCommand(printLine(sMessage));
}
}
}
else printLine(sMessage);
}
string getLine(string sMessage)
{
int nLetters = 12;
sLetter = "a";
while (nLetters >= 0)
{
sLetter = GetSubString(sMessage, nLetters, 1);
if (sLetter == " ")
{
ActionDoCommand(printLine(GetSubString(sMessage, 0, nLetters)));
sMessage = GetSubString(sMessage, nLetters + 1, nMessageLength - nLetters - 1);
ActionWait(8.0);
break;
}
nLetters--;
}
if (nLetters == -1)
{
SpeakString("Your words are too long.");
DelayCommand(0.8, SpeakString("I cannot understand you."));
sMessage = "";
}
return sMessage;
}
//uncomment to test
/*
void main()
{
}
*/