1 //**************************************************************************
2 //**
3 //**	##   ##    ##    ##   ##   ####     ####   ###     ###
4 //**	##   ##  ##  ##  ##   ##  ##  ##   ##  ##  ####   ####
5 //**	 ## ##  ##    ##  ## ##  ##    ## ##    ## ## ## ## ##
6 //**	 ## ##  ########  ## ##  ##    ## ##    ## ##  ###  ##
7 //**	  ###   ##    ##   ###    ##  ##   ##  ##  ##       ##
8 //**	   #    ##    ##    #      ####     ####   ##       ##
9 //**
10 //**	$Id: vc_state.h 3779 2008-09-10 21:28:18Z dj_jl $
11 //**
12 //**	Copyright (C) 1999-2006 Jānis Legzdiņš
13 //**
14 //**	This program is free software; you can redistribute it and/or
15 //**  modify it under the terms of the GNU General Public License
16 //**  as published by the Free Software Foundation; either version 2
17 //**  of the License, or (at your option) any later version.
18 //**
19 //**	This program is distributed in the hope that it will be useful,
20 //**  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 //**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 //**  GNU General Public License for more details.
23 //**
24 //**************************************************************************
25 
26 //==========================================================================
27 //
28 //	VState
29 //
30 //==========================================================================
31 
32 class VState : public VMemberBase
33 {
34 public:
35 	//
36 	// 	Frame flags:
37 	// 	handles maximum brightness (torches, muzzle flare, light sources)
38 	//
39 	enum { FF_FULLBRIGHT	= 0x80 };	// flag in Frame
40 	enum { FF_FRAMEMASK		= 0x7f };
41 
42 	//	Persistent fields
43 	//	State info
44 	VName			SpriteName;
45 	vint32			Frame;
46 	float			Time;
47 	vint32			Misc1;
48 	vint32			Misc2;
49 	VState*			NextState;
50 	VMethod*		Function;
51 	//	Linked list of states
52 	VState*			Next;
53 
54 	//	Compile time fields
55 	VName			GotoLabel;
56 	vint32			GotoOffset;
57 	VName			FunctionName;
58 
59 	//	Run-time fields
60 	vint32			SpriteIndex;
61 	vint32			InClassIndex;
62 	vint32			NetId;
63 	VState*			NetNext;
64 
65 	VState(VName, VMemberBase*, TLocation);
66 	~VState();
67 
68 	void Serialise(VStream&);
69 	void PostLoad();
70 
71 	bool Define();
72 	void Emit();
73 	bool IsInRange(VState*, VState*, int);
74 	bool IsInSequence(VState*);
75 	VState* GetPlus(int, bool);
76 
77 	friend inline VStream& operator<<(VStream& Strm, VState*& Obj)
78 	{ return Strm << *(VMemberBase**)&Obj; }
79 };
80