5 * Created by Alyssa Milburn on Thu 10 Mar 2005.
6 * Copyright (c) 2005-2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
21 // for enum lifestage (0 to 6)
25 #include "CreatureAgent.h"
29 class SkeletalCreature
: public CreatureAgent
{
31 class SkeletonPart
*skeleton
;
33 unsigned int ticks
; // TODO: unnecessary?
35 unsigned int posedirection
;
36 unsigned int pose
[17];
37 unsigned int facialexpression
;
38 unsigned int pregnancy
;
42 int oldfootx
, oldfooty
;
43 int lastgoodfootx
, lastgoodfooty
; // TODO: sucky code
45 shared_ptr
<class Room
> downfootroom
;
47 creatureAppearanceGene
*appearancegenes
[6];
48 std::map
<unsigned int, creaturePoseGene
*> posegenes
;
49 std::map
<unsigned int, creatureGaitGene
*> gaitgenes
;
51 shared_ptr
<creaturesImage
> images
[17];
54 int width
, height
, adjustx
, adjusty
;
55 int partx
[17], party
[17];
57 std::string
dataString(unsigned int _stage
, bool sprite
, unsigned int dataspecies
, unsigned int databreed
);
60 creatureGaitGene
*gaitgene
;
62 std::pair
<int, int> getCarryPoint();
71 creatureAppearanceGene
*appearanceGeneForPart(char p
);
72 shared_ptr
<creaturesImage
> tintBodySprite(shared_ptr
<creaturesImage
>);
75 SkeletalCreature(unsigned char _family
);
76 virtual ~SkeletalCreature();
78 void render(Surface
*renderer
, int xoffset
, int yoffset
);
79 virtual int handleClick(float, float);
82 void recalculateSkeleton();
84 unsigned int getPose(unsigned int i
) { return pose
[i
]; }
85 void setPose(unsigned int p
);
86 void setPose(std::string s
);
87 void setPoseGene(unsigned int p
);
88 void setGaitGene(unsigned int g
);
92 unsigned int getPregnancy() { return pregnancy
; }
93 void setPregnancy(unsigned int p
) { assert(p
< 4); pregnancy
= p
; }
94 bool getEyesClosed() { return eyesclosed
; }
95 void setEyesClosed(bool e
) { eyesclosed
= e
; }
96 unsigned int getFacialExpression() { return facialexpression
; }
97 void setFacialExpression(unsigned int f
) { assert (f
< 6); facialexpression
= f
; }
98 unsigned int getSkelWidth() { return width
; }
99 unsigned int getSkelHeight() { return height
; }
101 int attachmentX(unsigned int part
, unsigned int id
);
102 int attachmentY(unsigned int part
, unsigned int id
);
103 bool isLeftFootDown() { return downfoot_left
; }
105 CompoundPart
*part(unsigned int id
);
106 void setZOrder(unsigned int plane
);
111 std::string
getFaceSpriteName();
112 unsigned int getFaceSpriteFrame();
115 class SkeletonPart
: public AnimatablePart
{
116 friend class SkeletalCreature
;
119 SkeletonPart(SkeletalCreature
*p
);
123 void partRender(class Surface
*renderer
, int xoffset
, int yoffset
);
124 unsigned int getWidth() { return ((SkeletalCreature
*)parent
)->getSkelWidth(); }
125 unsigned int getHeight() { return ((SkeletalCreature
*)parent
)->getSkelHeight(); }
126 void setPose(unsigned int p
);
127 void setFrameNo(unsigned int f
);