COMMAND.H
资源名称:tc3d.zip [点击查看]
上传用户:abcdshs
上传日期:2007-01-07
资源大小:1858k
文件大小:3k
源码类别:
游戏
开发平台:
Visual C++
- // (C) Copyright 1996 by Anthony J. Carin. All Rights Reserved.
- #ifndef COMMAND_H
- #define COMMAND_H
- #include <time.h>
- inline short random(short v)
- {
- return (short)((rand()*v) / RAND_MAX);
- }
- enum insttype
- {
- ENDSESSION,
- INSERTFILE,
- THEYDO,
- TILTBODYRIGHT,
- TILTBODYLEFT,
- TILTBODYFWD,
- TILTBODYBCK,
- TURNHEADLEFT,
- TURNHEADRIGHT,
- TURNHEADUP,
- TURNHEADDOWN,
- RLEGBENDKNEE,
- LLEGBENDKNEE,
- RLEGRAISEFWD,
- LLEGRAISEFWD,
- RLEGRAISEBCK,
- LLEGRAISEBCK,
- RLEGRAISESIDE,
- LLEGRAISESIDE,
- RARMBENDELBOW,
- LARMBENDELBOW,
- RARMRAISEFWD,
- LARMRAISEFWD,
- RARMRAISEBCK,
- LARMRAISEBCK,
- RARMRAISESIDE,
- LARMRAISESIDE,
- TURNRIGHT,
- TURNLEFT,
- MOVEUPWARD,
- MOVEFOWARD,
- MOVEBACKWARD,
- PLAYSOUND,
- PLAYGENERIC,
- BEGINPROTECT,
- ENDPROTECT,
- STRIKETOP,
- STRIKEMED,
- STRIKEBOT,
- TILTRIGHTWEAPON,
- TILTLEFTWEAPON,
- CLEAR,
- HURTME,
- RTHROW,
- LTHROW,
- PICKUP,
- NOMORE,
- NOTEXIST
- };
- class instruction
- {
- public:
- instruction();
- instruction(instruction& i);
- ~instruction() { delete m_string; }
- insttype operator()() { return m_inst; }
- float value() { return m_value; }
- void operator=(instruction& i);
- void operator=(insttype v) { m_inst = v; }
- char *string() { return m_string; }
- void setvalue(float v) { m_value = v; }
- void setstring(char *);
- instruction *Next;
- private:
- insttype m_inst;
- float m_value;
- char *m_string;
- };
- class instlist
- {
- public:
- instlist() { First = Last = Current = 0; m_purgeold = m_protected = FALSE; }
- ~instlist() { purge(); }
- void add(instruction& i);
- instruction& next();
- void restart() { Current = First; }
- char nomore() { return (char)(Current == 0); }
- char isempty() { return (char)(First == 0); }
- void purgeold() { m_purgeold = TRUE; }
- void purge();
- void remove(insttype v);
- private:
- instruction *First;
- instruction *Last;
- instruction *Current;
- char m_purgeold;
- char m_protected;
- };
- class command
- {
- public:
- command(LPCTSTR filename);
- ~command() { delete m_instlist; }
- instruction& next() { return m_instlist->next(); }
- void restart() { m_instlist->restart(); }
- char nomore() { return m_instlist->nomore(); }
- void purge() { m_instlist->purge(); }
- void purgeold() { restart(); m_instlist->purgeold(); }
- void append(command& c);
- void remove(insttype v) { m_instlist->remove(v); }
- void add(instruction& i) { m_instlist->add(i); }
- char isempty() { return m_instlist->isempty(); }
- void AddToValue(insttype instruct, short bonus);
- private:
- instlist *m_instlist;
- };
- #endif