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.
179 lines
4.5 KiB
C++
179 lines
4.5 KiB
C++
//===========================================================================//
|
|
// File: Matcher.hpp //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 02/18/98 ECH Authored //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1998, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
|
|
|
#include "Adept.hpp"
|
|
#include "Channel.hpp"
|
|
#include "ComponentWeb.hpp"
|
|
|
|
namespace Adept {
|
|
|
|
//##########################################################################
|
|
//######################## MatcherChannel ############################
|
|
//##########################################################################
|
|
|
|
template <class T> class MatcherOf:
|
|
public ChannelOf<T>
|
|
{
|
|
public:
|
|
static void
|
|
InitializeClass();
|
|
static void
|
|
TerminateClass();
|
|
|
|
typedef ChannelOf<T> BaseClass;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Constructor/Destructor
|
|
//
|
|
public:
|
|
~MatcherOf();
|
|
|
|
static MatcherOf<T>*
|
|
Create(
|
|
MemoryStream *stream,
|
|
ComponentWeb *owning_web
|
|
);
|
|
|
|
protected:
|
|
MatcherOf(
|
|
ClassData *class_data,
|
|
MemoryStream *stream,
|
|
ComponentWeb *owning_web
|
|
);
|
|
|
|
void
|
|
SkipStreamData(MemoryStream *stream);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Virtual data
|
|
//
|
|
public:
|
|
static ClassData
|
|
*DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Component execution
|
|
//
|
|
public:
|
|
void
|
|
ChannelChanged(Channel *channel);
|
|
|
|
protected:
|
|
T
|
|
matchValue;
|
|
int
|
|
matchCommand,
|
|
missCommand;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Tool Support
|
|
//
|
|
public:
|
|
static ClassData*
|
|
CreateFactoryRequest(FactoryRequestParameters *parameters);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Test support
|
|
//
|
|
public:
|
|
void
|
|
TestInstance();
|
|
};
|
|
|
|
//
|
|
// Class Data Support
|
|
//
|
|
template <class T> ChannelOf<T>::ClassData*
|
|
MatcherOf<T>::DefaultData = NULL;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> void
|
|
MatcherOf<T>::TerminateClass()
|
|
{
|
|
Unregister_Object(DefaultData);
|
|
delete DefaultData;
|
|
DefaultData = NULL;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> MatcherOf<T>::~MatcherOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> MatcherOf<T>::MatcherOf(
|
|
ClassData *class_data,
|
|
MemoryStream *stream,
|
|
ComponentWeb *owning_web
|
|
):
|
|
ChannelOf<T>(class_data, stream, owning_web)
|
|
{
|
|
*stream >> matchValue >> matchCommand >> missCommand;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> void
|
|
MatcherOf<T>::SkipStreamData(MemoryStream *stream)
|
|
{
|
|
Check_Object(this);
|
|
Check_Object(stream);
|
|
|
|
BaseClass::SkipStreamData(stream);
|
|
stream->AdvancePointer(sizeof(T) + sizeof(int) + sizeof(int));
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> void
|
|
MatcherOf<T>::ChannelChanged(Channel *channel)
|
|
{
|
|
Check_Object(this);
|
|
Check_Object(channel);
|
|
|
|
ChannelOf<T>* input = Cast_Object(ChannelOf<T>*, channel);
|
|
|
|
channelOutput = input->ReadChannel();
|
|
if (Close_Enough(channelOutput, matchValue))
|
|
{
|
|
if (matchCommand != -1)
|
|
{
|
|
channelCommand = matchCommand;
|
|
NotifyDependantsOfChange();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (missCommand != -1)
|
|
{
|
|
channelCommand = missCommand;
|
|
NotifyDependantsOfChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
template <class T> void
|
|
MatcherOf<T>::TestInstance()
|
|
{
|
|
Verify(IsDerivedFrom(DefaultData));
|
|
}
|
|
|
|
}
|
|
|