Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
134 lines
3.6 KiB
C++
134 lines
3.6 KiB
C++
//=============================================================================
|
|
// File: Randomizer.cpp
|
|
// Project: MUNGA Brick: Entity
|
|
// Contents:
|
|
//-----------------------------------------------------------------------------
|
|
// Date Who Modification
|
|
// -------- --- -------------------------------------------------------------
|
|
// 12/14/94 JMA Initial coding.
|
|
//-----------------------------------------------------------------------------
|
|
// Copyright (C) 1994-1997, FASA Interactive, Inc.
|
|
// All Rights Reserved
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL
|
|
//=============================================================================
|
|
|
|
#include "AdeptHeaders.hpp"
|
|
|
|
#include "ComponentHeaders.hpp"
|
|
|
|
//#############################################################################
|
|
//####################### RandomizerOf<Scalar> ##########################
|
|
//#############################################################################
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
RandomizerOf<Scalar>::InitializeClass()
|
|
{
|
|
Verify(!DefaultData);
|
|
DefaultData =
|
|
new ClassData(
|
|
RandomizerOfScalarClassID,
|
|
"Adept::RandomizerOfScalar",
|
|
ChannelOf<Scalar>::DefaultData,
|
|
0,
|
|
NULL
|
|
);
|
|
Register_Object(DefaultData);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
RandomizerOf<Scalar>*
|
|
RandomizerOf<Scalar>::Create(
|
|
MemoryStream *stream,
|
|
ComponentWeb *owning_web
|
|
)
|
|
{
|
|
Check_Object(stream);
|
|
Check_Object(owning_web);
|
|
Component *component = DoesComponentExist(stream, owning_web);
|
|
RandomizerOf<Scalar> *randomizer;
|
|
if (component)
|
|
{
|
|
randomizer = Cast_Object(RandomizerOf<Scalar>*, component);
|
|
randomizer->SkipStreamData(stream);
|
|
}
|
|
else
|
|
{
|
|
randomizer = new RandomizerOf<Scalar>(DefaultData, stream, owning_web);
|
|
Register_Object(randomizer);
|
|
}
|
|
return randomizer;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
RandomizerOf<Scalar>::Execute()
|
|
{
|
|
Check_Object(this);
|
|
|
|
channelOutput = minValue + valueRange * Random::GetFraction();
|
|
|
|
NotifyDependantsOfChange();
|
|
}
|
|
|
|
//#############################################################################
|
|
//######################### RandomizerOf<int> ###########################
|
|
//#############################################################################
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
RandomizerOf<int>::InitializeClass()
|
|
{
|
|
Verify(!DefaultData);
|
|
DefaultData =
|
|
new ClassData(
|
|
RandomizerOfIntClassID,
|
|
"Adept::RandomizerOfInt",
|
|
ChannelOf<int>::DefaultData,
|
|
0,
|
|
NULL
|
|
);
|
|
Register_Object(DefaultData);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
RandomizerOf<int>*
|
|
RandomizerOf<int>::Create(
|
|
MemoryStream *stream,
|
|
ComponentWeb *owning_web
|
|
)
|
|
{
|
|
Check_Object(stream);
|
|
Check_Object(owning_web);
|
|
Component *component = DoesComponentExist(stream, owning_web);
|
|
RandomizerOf<int> *randomizer;
|
|
if (component)
|
|
{
|
|
randomizer = Cast_Object(RandomizerOf<int>*, component);
|
|
randomizer->SkipStreamData(stream);
|
|
}
|
|
else
|
|
{
|
|
randomizer = new RandomizerOf<int>(DefaultData, stream, owning_web);
|
|
Register_Object(randomizer);
|
|
}
|
|
return randomizer;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
RandomizerOf<int>::Execute()
|
|
{
|
|
Check_Object(this);
|
|
|
|
channelOutput = minValue + Random::GetLessThan(valueRange);
|
|
|
|
NotifyDependantsOfChange();
|
|
}
|