//
// Header file for spells
//
// Copyright (C) 2006 Nathan (Acorn) Pooley
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License (gpl.txt) for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// You can contact the author, Nathan (Acorn) Pooley, by writing
// to Nathan (Acorn) Pooley, 949 Buckeye Drive, Sunnyvale, CA 94086, USA
// or through the form at http://www.rawbw.com/~acorn/wand/feedback.html
//
typedef struct SpellRec {
int flags;
int maxscore;
int holdoff;
const char *name;
const char *mwanemes;
} Spell;
extern Spell spells[];
//
// Format of spell in memory
// -------------------------
// byte descrip
// ---- -------
// 0 spellinfol
// 1 spellinfol
// 2 starting octant
// 3 tokens...
//
//
// Spell token bits
// ----------------
// 7 - 1=pulse 0=circle
//
// pulse
// 7 - 1
// 6 - direction (used, but initial value does not matter)
// 5 - must be 1
// 5-3 - unused
// 2-0 - oct
//
// circle
// 7 - 0
// 6 - direction
// 5 - must be 1
// 4-3 - cnt-1 (0 1 or 2)
// 2-0 - unused (oct)
//
// Last byte is 0x00 - check bit 5
//
#define MWN_OCT_MASK 0x07
#define MWN_CNT_MASK 0x18
#define MWN_PULSE 0x80
#define MWN_DIR 0x40
#define MWN_MORE 0x20
#define PIC_MWN_CREATE_CIRC(dir,cnt) \
((((dir)<0)?MWN_DIR:0) | \
((((cnt)-1)&3)<<3) | \
MWN_MORE)
#define PIC_MWN_CREATE_PULSE(oct) \
(((oct)&7) | \
MWN_PULSE | \
MWN_MORE)
#define PIC_MWN_END(m) (!((m)&MWN_MORE))
#define PIC_MWN_MORE(m) ((m)&MWN_MORE)
#define PIC_MWN_PULSE(m) ((m)&MWN_PULSE)
#define PIC_MWN_OCT(m) ((m)&MWN_OCT_MASK)
#define PIC_MWN_CNT(m) (PIC_MWN_PULSE(m)?0:((((m)&MWN_CNT_MASK)>>3)+1))
#define PIC_MWN_DIR(m) (PIC_MWN_PULSE(m)?0:(((m)>>6)&1)?-1:1)
//
// This is the word following the last spell's mwanemes
// It appears in v_mo_spellinfol,h when w_mo7_load_spell is called after the
// last spell has been loaded.
//
#define PIC_MWN_END_SPELLS 0xffff
#define TOKEN_CREATE_MO(shape,dir,angle) \
((((dir)<0)?0x80:0) | \
(((((angle)))>>1) & 0xf) | \
((shape)==MSHP_PAUSE ? 0x8f : 0) | \
(((shape)&7) << 4))
#define TOKEN_CREATE_SP(shape,dir,angle) \
((((dir)<0)?0x80:0) | \
(((((angle)))>>1) & 0xf) | \
((shape)==SSHP_PAUSE ? 0x8f : 0) | \
(((shape)&7) << 4))
#define TOKEN_SHAPE(tok) (((tok)&0x70)>>4)
#define TOKEN_DIR(tok) (((tok)&0x80)?-1:1)
#define TOKEN_ANGLE(tok) (((tok)&0x0f)<<1)
#define MTOKEN_END (0xfe)
#define STOKEN_END (0x00)
#define TOK_DIR 0x80
#define TOK_SHAPE_MASK 0x70
#define TOK_ANGLE_MASK 0x0f
#define MSHF_PLUS 0x01 // (part of shape)
#define MSHF_PULSE 0x04 // (part of shape)
#define MSHF_CLEAN 0x02 // (part of shape)
#define MSHF_SHP_MASK 0x07 // (all bits of shape)
#define MSHF_FLG_MASK (~MSHF_SHP_MASK) // (flag bits from shape)
#define MSHF_DIR 0x08 // dir (set if cw (negative))
#define MSHF_CIRCLE 0x20 //
#define MSHF_PREV_PAUSE 0x80 // set if preceded by pause
#define MSHF_MONO 0x40 //
//
// MSHF_NEAR_PLUS used only in findBestPulses_minimal()
//
#define MSHF_NEAR_PLUS 0x10 // set if near a plus
//
// MSHF_ZERO used only in parse1
//
#define MSHF_ZERO 0x01 // hit zero
#define ANGLE_END 0xc0
#define ANGLE_START 0xa0
#define ANGLE_MASK 0x1f
#define AFLG_END 0x40
#define AFLG_START 0x20
#define AFLG_STARTEND 0x80
//typedef enum SpellShapeEnum {
#define SSHP_PAUSE 0
#define SSHP_CIRCLE 1
#define SSHP_OCIRCLE 2
#define SSHP_OPULSE 3
#define SSHP_PULSE 4
#define SSHP_WILD 5
#define SSHP_CNT 6
//} SpellShape;
#define SPELL_SHAPE_STRING() \
"Pause", \
"Circle", \
"OCircle", \
"OPulse", \
"Pulse", \
"Wild", \
//typedef enum MotionShapeEnum {
#define MSHP_DIRTY_CIRCLE 0
#define MSHP_DIRTY_CIRCLE_PLUS 1
#define MSHP_CLEAN_CIRCLE 2
#define MSHP_CLEAN_CIRCLE_PLUS 3
#define MSHP_PULSE 4
#define MSHP_PULSE_PLUS 5
#define MSHP_CIRCLE_GAP 6
#define MSHP_PAUSE 7
// PAUSE is unused in minimal
#define MSHP_CNT 8
//} MotionShape;
#define MOTION_SHAPE_STRING() \
"Drt Circ ", \
"Drt Circ+", \
"Cln Circ ", \
"Cln Circ+", \
"Pulse ", \
"Pulse+ ", \
"CircleGap", \
"PAUSE", \
|
This file Copyright (C) 2006 by Nathan (Acorn) Pooley
Go to TOP Wand page
Go to Acorn's personal webpage
Go to Hogwarts website: www.gotohogwarts.com
Snout: www.snout.org/game
Gadgets of Justice Unlimited
Snout GC (Wiki)
Snout Wiki
File created by do_doc at Wed May 30 03:30:21 PDT 2007