freg  0.3
Free-Roaming Elementary Game
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Shred Class Referencefinal

#include <Shred.h>

Inheritance diagram for Shred:
Inheritance graph
[legend]
Collaboration diagram for Shred:
Collaboration graph
[legend]

Public Member Functions

 Shred (int shred_x, int shred_y, long longi, long lati)
 
 ~Shred ()
 
Shredoperator= (Shred &)=delete
 
 Shred (Shred &)=delete
 
long Longitude () const
 Returns y (line) shred coordinate on world map. More...
 
long Latitude () const
 Returns x (column) shred coordinate on world map. More...
 
int ShredX () const
 
int ShredY () const
 
void PhysEventsFrequent ()
 
void PhysEventsRare ()
 
void Register (Active *)
 
void Unregister (Active *)
 
void AddShining (Active *)
 
void RemShining (Active *)
 
void AddToDelete (Active *)
 
void ReloadTo (dirs)
 
QLinkedList< Active *const >
::const_iterator 
ShiningBegin () const
 
QLinkedList< Active *const >
::const_iterator 
ShiningEnd () const
 
WorldGetWorld () const
 
BlockGetBlock (const int x, const int y, const int z) const
 
void SetBlock (Block *block, int x, int y, int z)
 Removes last block at xyz, then SetBlock, then makes block normal. More...
 
void SetBlockNoCheck (Block *, int x, int y, int z)
 Puts block to coordinates xyz and activates it. More...
 
void AddFalling (Block *)
 
void PutBlock (Block *const block, const int x, int y, int z)
 
int Lightmap (int x, int y, int z) const
 
int FireLight (int x, int y, int z) const
 
int SunLight (int x, int y, int z) const
 
int LightLevel (int x, int y, int z) const
 
bool SetSunLight (int x, int y, int z, int level)
 
bool SetFireLight (int x, int y, int z, int level)
 
void SetLightmap (int x, int y, int z, int level)
 
void SetAllLightMapNull ()
 
void ShineAll ()
 Makes all shining blocks of shred shine. More...
 
void SetNewBlock (int kind, int sub, int x, int y, int z, int dir=UP)
 
shred_type GetTypeOfShred () const
 
ShredGetShredMemory () const
 
long GlobalX (int x) const
 Make global coordinate from local (in loaded zone). More...
 
long GlobalY (int y) const
 
void Rain (int kind, int sub)
 
void Dew (int kind, int sub)
 
- Public Member Functions inherited from Weather
void SetWeather (weathers)
 
weathers GetWeather () const
 

Static Public Member Functions

static BlockNormal (int sub)
 Puts block to coordinates, not activates it. More...
 
static QString FileName (QString world_name, long longi, long lati)
 
static int CoordInShred (const int x)
 Get local coordinate. More...
 
static int CoordOfShred (const int x)
 Get shred coordinate in loaded zone (from 0 to numShreds). More...
 
static bool InBounds (int x, int y, int z)
 Lowest nullstone and sky are not in bounds. More...
 
static bool InBounds (int x, int y)
 
static bool InBounds (int z)
 
static QString ShredTypeName (shred_type)
 
- Static Public Member Functions inherited from Weather
static QString GetWeatherString (weathers)
 

Private Member Functions

void RemoveAllSunLight ()
 
void RemoveAllFireLight ()
 
void RemoveAllLight ()
 
bool LoadShred ()
 
void RegisterInit (Active *)
 
void NormalUnderground (int depth=0, subs sub=SOIL)
 
void CoverWith (int kind, int sub)
 
void RandomDrop (int num, int kind, int sub, bool on_water=false)
 Puts num things(kind-sub) in random places on shred surface. More...
 
void DropBlock (Block *bloc, bool on_water)
 
int CountShredTypeAround (int type) const
 
void PlantGrass ()
 
void TestShred ()
 
void NullMountain ()
 
void Plain ()
 
void Forest (bool dead)
 
void Water (subs sub=WATER)
 
void Pyramid ()
 
void Mountain ()
 
void Hill (bool dead)
 
void Desert ()
 
void Castle ()
 
void WasteShred ()
 
void ChaosShred ()
 For testing purposes. More...
 
void LoadRoom (int level, int index=0)
 
bool Tree (int x, int y, int z, int height)
 Block combinations section (trees, buildings, etc): More...
 
void ShredLandAmplitudeAndLevel (long longi, long lati, ushort *l, float *a) const
 Special land generation. More...
 
void ShredNominalAmplitudeAndLevel (char shred_type, ushort *l, float *a) const
 
void AddWater ()
 
int FlatUndeground (int depth=0)
 
void NormalCube (int x_start, int y_start, int z_start, int x_size, int y_size, int z_size, subs)
 
void RainBlock (int *kind, int *sub) const
 

Private Attributes

Blockblocks [SHRED_WIDTH][SHRED_WIDTH][HEIGHT]
 
uchar lightMap [SHRED_WIDTH][SHRED_WIDTH][HEIGHT]
 
const long longitude
 
const long latitude
 
int shredX
 
int shredY
 
shred_type type
 
QLinkedList< Active * > activeListAll
 Contains all active blocks. More...
 
QLinkedList< Active * > activeListFrequent
 
QLinkedList< Active *const > shiningList
 
QLinkedList< Falling * > fallList
 
weathers weather
 

Detailed Description

Definition at line 32 of file Shred.h.

Constructor & Destructor Documentation

Shred::Shred ( int  shred_x,
int  shred_y,
long  longi,
long  lati 
)

Definition at line 119 of file Shred.cpp.

Shred::~Shred ( )

Definition at line 171 of file Shred.cpp.

Shred::Shred ( Shred )
delete

Member Function Documentation

void Shred::AddFalling ( Block block)

Definition at line 277 of file Shred.cpp.

void Shred::AddShining ( Active active)

Definition at line 285 of file Shred.cpp.

void Shred::AddToDelete ( Active )
void Shred::AddWater ( )
private
void Shred::Castle ( )
private

Definition at line 491 of file Shred.cpp.

void Shred::ChaosShred ( )
private

For testing purposes.

Definition at line 539 of file Shred.cpp.

static int Shred::CoordInShred ( const int  x)
inlinestatic

Get local coordinate.

Definition at line 100 of file Shred.h.

static int Shred::CoordOfShred ( const int  x)
inlinestatic

Get shred coordinate in loaded zone (from 0 to numShreds).

Definition at line 103 of file Shred.h.

int Shred::CountShredTypeAround ( int  type) const
private

Definition at line 593 of file Shred.cpp.

void Shred::CoverWith ( int  kind,
int  sub 
)
private

Definition at line 350 of file Shred.cpp.

void Shred::Desert ( )
private

Definition at line 204 of file Shred-gen-flat.cpp.

void Shred::Dew ( int  kind,
int  sub 
)

Definition at line 613 of file Shred.cpp.

void Shred::DropBlock ( Block bloc,
bool  on_water 
)
private

Definition at line 367 of file Shred.cpp.

QString Shred::FileName ( QString  world_name,
long  longi,
long  lati 
)
static

Definition at line 340 of file Shred.cpp.

int Shred::FireLight ( int  x,
int  y,
int  z 
) const

Definition at line 227 of file Lighting-inertia.cpp.

int Shred::FlatUndeground ( int  depth = 0)
private

Definition at line 25 of file Shred-gen-flat.cpp.

void Shred::Forest ( bool  dead)
private

Definition at line 53 of file Shred-gen-flat.cpp.

Block* Shred::GetBlock ( const int  x,
const int  y,
const int  z 
) const
inline

Definition at line 61 of file Shred.h.

Shred* Shred::GetShredMemory ( ) const
shred_type Shred::GetTypeOfShred ( ) const

Definition at line 65 of file Shred.cpp.

World * Shred::GetWorld ( ) const

Definition at line 63 of file Shred.cpp.

long Shred::GlobalX ( int  x) const

Make global coordinate from local (in loaded zone).

Definition at line 196 of file Shred.cpp.

long Shred::GlobalY ( int  y) const

Definition at line 200 of file Shred.cpp.

void Shred::Hill ( bool  dead)
private

Definition at line 119 of file Shred-gen-flat.cpp.

bool Shred::InBounds ( int  x,
int  y,
int  z 
)
static

Lowest nullstone and sky are not in bounds.

Definition at line 609 of file Shred.cpp.

bool Shred::InBounds ( int  x,
int  y 
)
static

Definition at line 605 of file Shred.cpp.

bool Shred::InBounds ( int  z)
static

Definition at line 603 of file Shred.cpp.

long Shred::Latitude ( ) const

Returns x (column) shred coordinate on world map.

Definition at line 60 of file Shred.cpp.

int Shred::LightLevel ( int  x,
int  y,
int  z 
) const
int Shred::Lightmap ( int  x,
int  y,
int  z 
) const

Definition at line 223 of file Lighting-inertia.cpp.

void Shred::LoadRoom ( int  level,
int  index = 0 
)
private

Loads room from corresponding .room or -index.room file. Should be placed before any other block generation at the same place.

Definition at line 632 of file Shred.cpp.

bool Shred::LoadShred ( )
private

Definition at line 67 of file Shred.cpp.

long Shred::Longitude ( ) const

Returns y (line) shred coordinate on world map.

Definition at line 59 of file Shred.cpp.

void Shred::Mountain ( )
private

Definition at line 152 of file Shred-gen-flat.cpp.

Block * Shred::Normal ( int  sub)
static

Puts block to coordinates, not activates it.

Definition at line 64 of file Shred.cpp.

void Shred::NormalCube ( int  x_start,
int  y_start,
int  z_start,
int  x_size,
int  y_size,
int  z_size,
subs  sub 
)
private

Definition at line 549 of file Shred.cpp.

void Shred::NormalUnderground ( int  depth = 0,
subs  sub = SOIL 
)
private

Definition at line 30 of file Shred-gen-flat.cpp.

void Shred::NullMountain ( )
private

Definition at line 429 of file Shred.cpp.

Shred& Shred::operator= ( Shred )
delete
void Shred::PhysEventsFrequent ( )

Definition at line 204 of file Shred.cpp.

void Shred::PhysEventsRare ( )
Todo:
add explosion

Definition at line 232 of file Shred.cpp.

void Shred::Plain ( )
private

Definition at line 44 of file Shred-gen-flat.cpp.

void Shred::PlantGrass ( )
private

Definition at line 378 of file Shred.cpp.

void Shred::PutBlock ( Block *const  block,
const int  x,
int  y,
int  z 
)
inline

Definition at line 73 of file Shred.h.

void Shred::Pyramid ( )
private

Definition at line 462 of file Shred.cpp.

void Shred::Rain ( int  kind,
int  sub 
)

Definition at line 617 of file Shred.cpp.

void Shred::RainBlock ( int *  kind,
int *  sub 
) const
private
void Shred::RandomDrop ( int  num,
int  kind,
int  sub,
bool  on_water = false 
)
private

Puts num things(kind-sub) in random places on shred surface.

If on_water is false, this will not drop things on water, otherwise on water too.

Definition at line 359 of file Shred.cpp.

void Shred::Register ( Active active)

Definition at line 260 of file Shred.cpp.

void Shred::RegisterInit ( Active active)
private

Definition at line 248 of file Shred.cpp.

void Shred::ReloadTo ( dirs  direction)

Definition at line 301 of file Shred.cpp.

void Shred::RemoveAllFireLight ( )
private
void Shred::RemoveAllLight ( )
private
void Shred::RemoveAllSunLight ( )
private
void Shred::RemShining ( Active active)

Definition at line 291 of file Shred.cpp.

void Shred::SetAllLightMapNull ( )

Definition at line 261 of file Lighting-inertia.cpp.

void Shred::SetBlock ( Block block,
int  x,
int  y,
int  z 
)

Removes last block at xyz, then SetBlock, then makes block normal.

Definition at line 311 of file Shred.cpp.

void Shred::SetBlockNoCheck ( Block block,
int  x,
int  y,
int  z 
)

Puts block to coordinates xyz and activates it.

Definition at line 322 of file Shred.cpp.

bool Shred::SetFireLight ( int  x,
int  y,
int  z,
int  level 
)

Definition at line 245 of file Lighting-inertia.cpp.

void Shred::SetLightmap ( int  x,
int  y,
int  z,
int  level 
)

Definition at line 256 of file Lighting-inertia.cpp.

void Shred::SetNewBlock ( int  kind,
int  sub,
int  x,
int  y,
int  z,
int  dir = UP 
)

Definition at line 332 of file Shred.cpp.

bool Shred::SetSunLight ( int  x,
int  y,
int  z,
int  level 
)

Definition at line 235 of file Lighting-inertia.cpp.

void Shred::ShineAll ( )

Makes all shining blocks of shred shine.

Definition at line 264 of file Lighting-inertia.cpp.

QLinkedList< Active *const >::const_iterator Shred::ShiningBegin ( ) const

Definition at line 293 of file Shred.cpp.

QLinkedList< Active *const >::const_iterator Shred::ShiningEnd ( ) const

Definition at line 297 of file Shred.cpp.

void Shred::ShredLandAmplitudeAndLevel ( long  longi,
long  lati,
ushort *  l,
float *  a 
) const
private

Special land generation.

void Shred::ShredNominalAmplitudeAndLevel ( char  shred_type,
ushort *  l,
float *  a 
) const
private
QString Shred::ShredTypeName ( shred_type  type)
static

Definition at line 32 of file Shred.cpp.

int Shred::ShredX ( ) const

Definition at line 61 of file Shred.cpp.

int Shred::ShredY ( ) const

Definition at line 62 of file Shred.cpp.

int Shred::SunLight ( int  x,
int  y,
int  z 
) const

Definition at line 231 of file Lighting-inertia.cpp.

void Shred::TestShred ( )
private

Definition at line 391 of file Shred.cpp.

bool Shred::Tree ( int  x,
int  y,
int  z,
int  height 
)
private

Block combinations section (trees, buildings, etc):

Definition at line 563 of file Shred.cpp.

void Shred::Unregister ( Active active)

Definition at line 265 of file Shred.cpp.

void Shred::WasteShred ( )
private

Definition at line 211 of file Shred-gen-flat.cpp.

void Shred::Water ( subs  sub = WATER)
private

Definition at line 79 of file Shred-gen-flat.cpp.

Member Data Documentation

QLinkedList<Active *> Shred::activeListAll
private

Contains all active blocks.

Definition at line 175 of file Shred.h.

QLinkedList<Active *> Shred::activeListFrequent
private

Definition at line 176 of file Shred.h.

Block* Shred::blocks[SHRED_WIDTH][SHRED_WIDTH][HEIGHT]
private

Definition at line 168 of file Shred.h.

QLinkedList<Falling *> Shred::fallList
private

Definition at line 178 of file Shred.h.

const long Shred::latitude
private

Definition at line 170 of file Shred.h.

uchar Shred::lightMap[SHRED_WIDTH][SHRED_WIDTH][HEIGHT]
private

Definition at line 169 of file Shred.h.

const long Shred::longitude
private

Definition at line 170 of file Shred.h.

QLinkedList<Active * const> Shred::shiningList
private

Definition at line 177 of file Shred.h.

int Shred::shredX
private

Definition at line 171 of file Shred.h.

int Shred::shredY
private

Definition at line 171 of file Shred.h.

shred_type Shred::type
private

Definition at line 172 of file Shred.h.

weathers Shred::weather
private

Definition at line 180 of file Shred.h.


The documentation for this class was generated from the following files: