1 /////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2004-2010 by The Allacrost Project 3 // All Rights Reserved 4 // 5 // This code is licensed under the GNU GPL version 2. It is free software 6 // and you may modify it and/or redistribute it under the terms of this license. 7 // See http://www.gnu.org/copyleft/gpl.html for details. 8 /////////////////////////////////////////////////////////////////////////////// 9 10 /** **************************************************************************** 11 *** \file sprites.h 12 *** \author Dale Ma, dalema22@gmail.com 13 *** \brief Header file for editor sprite code. 14 *** *****************************************************************************/ 15 16 #ifndef __SPRITES_HEADER__ 17 #define __SPRITES_HEADER__ 18 19 #include "utils.h" 20 #include "defs.h" 21 #include "video.h" 22 23 #include <QRectF> 24 #include <QPointF> 25 26 namespace hoa_editor { 27 28 // *********************** SPRITE CONSTANTS ************************** 29 30 /** \name Map Sprite Speeds 31 *** \brief Common speeds for sprite movement. 32 *** These values are the time (in milliseconds) that it takes a sprite to walk 33 *** the distance of one map grid (16 pixels). 34 **/ 35 //@{ 36 const float VERY_SLOW_SPEED = 225.0f; 37 const float SLOW_SPEED = 190.0f; 38 const float NORMAL_SPEED = 150.0f; 39 const float FAST_SPEED = 110.0f; 40 const float VERY_FAST_SPEED = 75.0f; 41 //@} 42 43 /** \name Position Transferring Factors 44 *** \breif Position transfering factor from game to editor 45 **/ 46 //@{ 47 const float X_POS_FACTOR = 2.0f; 48 const float Y_POS_FACTOR = 2.0f; 49 //@} 50 51 /** \name Map Object Type Constants 52 *** These constants are used to identify the type of map object or sprite. 53 **/ 54 //@{ 55 const uint8 PHYSICAL_TYPE = 0; 56 const uint8 VIRTUAL_TYPE = 1; 57 const uint8 SPRITE_TYPE = 2; 58 const uint8 ENEMY_TYPE = 3; 59 const uint8 TREASURE_TYPE = 4; 60 //@} 61 62 /** \name Sprite Direction Constants 63 *** \brief Constants used for setting and determining sprite directions 64 *** Sprites are allowed to travel in eight different directions, however the sprite itself 65 *** can only be facing one of four ways: north, south, east, or west. Because of this, it 66 *** is possible to travel, for instance, northwest facing north <i>or</i> northwest facing west. 67 *** The "NW_NORTH" constant means that the sprite is traveling to the northwest and is 68 *** facing towards the north. 69 *** 70 *** \note The set of "FACING_DIRECTION" and "MOVING_DIRECTION" constants are only meant to be 71 *** used as shorthands. You shouldn't assign the MapSprite#direction member to any of these values. 72 **/ 73 //@{ 74 const uint16 NORTH = 0x0001; 75 const uint16 SOUTH = 0x0002; 76 const uint16 WEST = 0x0004; 77 const uint16 EAST = 0x0008; 78 const uint16 NW_NORTH = 0x0010; 79 const uint16 NW_WEST = 0x0020; 80 const uint16 NE_NORTH = 0x0040; 81 const uint16 NE_EAST = 0x0080; 82 const uint16 SW_SOUTH = 0x0100; 83 const uint16 SW_WEST = 0x0200; 84 const uint16 SE_SOUTH = 0x0400; 85 const uint16 SE_EAST = 0x0800; 86 87 const uint16 NORTHWEST = NW_NORTH | NW_WEST; 88 const uint16 NORTHEAST = NE_NORTH | NE_EAST; 89 const uint16 SOUTHWEST = SW_SOUTH | SW_WEST; 90 const uint16 SOUTHEAST = SE_SOUTH | SE_EAST; 91 92 const uint16 FACING_NORTH = NORTH | NW_NORTH | NE_NORTH; 93 const uint16 FACING_SOUTH = SOUTH | SW_SOUTH | SE_SOUTH; 94 const uint16 FACING_WEST = WEST | NW_WEST | SW_WEST; 95 const uint16 FACING_EAST = EAST | NE_EAST | SE_EAST; 96 97 const uint16 LATERAL_MOVEMENT = NORTH | SOUTH | EAST | WEST; 98 const uint16 DIAGONAL_MOVEMENT = NORTHWEST | NORTHEAST | SOUTHWEST | SOUTHEAST; 99 //@} 100 101 /** \name Map Sprite Animation Constants 102 *** These constants are used to index the MapSprite#animations vector to display the correct 103 *** animation. The first 8 entries in this vector always represent the same sets of animations 104 *** for each map sprite. 105 **/ 106 //@{ 107 const uint32 ANIM_STANDING_SOUTH = 0; 108 const uint32 ANIM_STANDING_NORTH = 1; 109 const uint32 ANIM_STANDING_WEST = 2; 110 const uint32 ANIM_STANDING_EAST = 3; 111 const uint32 ANIM_WALKING_SOUTH = 4; 112 const uint32 ANIM_WALKING_NORTH = 5; 113 const uint32 ANIM_WALKING_WEST = 6; 114 const uint32 ANIM_WALKING_EAST = 7; 115 const uint32 ANIM_RUNNING_SOUTH = 8; 116 const uint32 ANIM_RUNNING_NORTH = 9; 117 const uint32 ANIM_RUNNING_WEST = 10; 118 const uint32 ANIM_RUNNING_EAST = 11; 119 //@} 120 121 /** **************************************************************************** 122 *** \brief An invisible and possible mobile sprite on a map 123 *** 124 *** The VirtualSprite is a special type of MapObject because it has no physical 125 *** form (no image). Virtual sprites may be manipulated to move around on the screen, 126 *** or they may remain stationary. VirtualSprites do take collision detection into account 127 *** by default, unless the no_collision member is set to true. Here are some examples of 128 *** where virtual sprites may be of use: 129 *** 130 *** - As a mobile focusing point for the map camera 131 *** - As an impassible map location for ground objects in a specific context only 132 *** - To set impassible locations for objects in the sky layer 133 *** ***************************************************************************/ 134 class VirtualSprite { 135 public: 136 /** \brief A bit-mask for the sprite's draw orientation and direction vector. 137 *** This member determines both where to move the sprite (8 directions) and 138 *** which way the sprite is facing (4 directions). See the Sprite Directions 139 *** series of constants for the values that this member may be set to. 140 **/ 141 uint16 direction; 142 143 //! \brief The speed at which the sprite moves around the map. 144 float movement_speed; 145 146 /** \brief Set to true when the sprite is currently moving. 147 *** \note This does not necessarily mean that the sprite actually is moving, but rather that 148 *** the sprite is <i>trying</i> to move in a certain direction. 149 **/ 150 bool moving; 151 152 //! \brief Set to true when the sprite is running rather than just walking 153 bool is_running; 154 155 //! \brief Set to selected in the editor 156 bool is_selected; 157 158 /** \brief When set to true, indicates that the object exists on the sky object layer (default = false). 159 *** This member is necessary for collision detection purposes. When a sprite needs to detect 160 *** if it has encountered a collision, that collision must be examined with other objects on 161 *** the appropriate layer (the ground or sky layer). 162 **/ 163 bool sky_object; 164 165 //! \brief The name of the sprite, as seen by the player in the game. 166 hoa_utils::ustring name; 167 168 //! \brief A pointer to the face portrait of the sprite, as seen in dialogues and menus. 169 hoa_video::StillImage* face_portrait; 170 171 //! \brief Set to false if the sprite contains dialogue that has not been seen by the player 172 //bool seen_all_dialogue; 173 174 //! \brief True is sprite contains active dialogue. 175 //bool has_active_dialogue; 176 177 /** \brief An index to the actions vector, representing the current sprite action being performed. 178 *** A negative value indicates that the sprite is taking no action. If the sprite has no entries 179 *** in its actions vector, this member should remain negative, otherwise a segmentation fault 180 *** will occur. 181 **/ 182 int8 current_action; 183 184 // TODO: change how forced action work 185 //int8 forced_action; 186 187 //! \brief A container for all of the actions this sprite performs. 188 //std::vector<SpriteAction*> actions; 189 190 /** \name Saved state attributes 191 *** These attributes are used to save and load the state of a VirtualSprite 192 **/ 193 //@{ 194 //! \brief This indicates if a state was saved or not. 195 bool _saved; 196 uint16 _saved_direction; 197 float _saved_movement_speed; 198 bool _saved_moving; 199 hoa_utils::ustring _saved_name; 200 //int8 _saved_current_action; 201 //@} 202 203 //! \brief This vector contains all the dialogues of the sprite 204 //std::vector<MapDialogue*> dialogues; 205 206 /** \brief An index to the dialogues vector, representing the current sprite dialogue to 207 *** display when talked to by the player. A negative value indicates that the sprite has no dialogue. 208 *** \note If the sprite has no entries in its dialogues vector, this member should remain negative, 209 *** otherwise a segmentation fault will occur. 210 **/ 211 //int16 _current_dialogue; 212 213 //! \brief Indicates if the icon indicating that there is a dialogue available should be drawn or not. 214 //bool _show_dialogue_icon; 215 216 //! \brief Used to fade the dialogue icon according to distance 217 //hoa_video::Color _dialogue_icon_color; 218 219 /** \brief An identification number for the object as it is represented in the map file. 220 *** Player sprites are assigned object ids from 5000 and above. Technically this means that 221 *** a map can have no more than 5000 objects that are not player sprites, but no map should 222 *** need to contain that many objects in the first place. Objects with an ID less than zero 223 *** are invalid. 224 **/ 225 int16 object_id; 226 227 /** \brief The map context that the object currently resides in. 228 *** Context helps to determine where an object "resides". For example, inside of a house or 229 *** outside of a house. The context member determines if the object should be drawn or not, 230 *** since objects are only drawn if they are in the same context as the map's camera. 231 *** Objects can only interact with one another if they both reside in the same context. 232 *** 233 *** \note The default value for this member is -1. A negative context indicates that the 234 *** object is invalid and it does not exist anywhere. Objects with a negative context are never 235 *** drawn to the screen. A value equal to zero indicates that the object is "always in 236 *** context", meaning that the object will be drawn regardless of the current context. An 237 *** example of where this is useful is a bridge, which shouldn't simply disappear because the 238 *** player walks inside a nearby home. 239 **/ 240 uint32 context; 241 242 /** \brief Coordinates for the object's origin/position. 243 *** The origin of every map object is the bottom center point of the object. These 244 *** origin coordinates are used to determine where the object is on the map as well 245 *** as where the objects collision rectangle lies. 246 *** 247 *** The position coordinates are described by an integer (position) and a float (offset). 248 *** The position coordinates point to the map grid tile that the object currently occupies 249 *** and may range from 0 to the number of columns or rows of grid tiles on the map. The 250 *** offset member will always range from 0.0f and 1.0f to indicate the exact position of 251 *** the object within that tile. 252 **/ 253 //@{ 254 uint16 x_position, y_position; 255 float x_offset, y_offset; 256 //@} 257 258 /** \brief The half-width and height of the image, in map grid coordinates. 259 *** The half_width member is indeed just that: half the width of the object's image. We keep 260 *** the half width rather than the full width because the origin of the object is its bottom 261 *** center, and it is more convenient to store only half the sprite's width as a result. 262 *** 263 *** \note These members assume that the object retains the same width and height regardless 264 *** of the current animation or image being drawn. If the object's image changes size, the 265 *** API user must remember to change these values accordingly. 266 **/ 267 float img_half_width, img_height; 268 269 /** \brief Determines the collision rectangle for the object. 270 *** The collision area determines what portion of the map object may not be overlapped 271 *** by other objects or unwalkable regions of the map. The x and y coordinates are 272 *** relative to the origin, so an x value of 0.5f means that the collision rectangle 273 *** extends the length of 1/2 of a tile from the origin on both sides, and a y value 274 *** of 1.0f means that the collision area exists from the origin to 1 tile's length 275 *** above. 276 *** 277 *** \note These members should always be positive. Setting these members to zero does *not* 278 *** eliminate collision detection for the object, and therefore they should usually never 279 *** be zero. 280 **/ 281 float coll_half_width, coll_height; 282 283 //! \brief When set to false, the Update() function will do nothing (default = true). 284 bool updatable; 285 286 //! \brief When set to false, the Draw() function will do nothing (default = true). 287 bool visible; 288 289 /** \brief When set to true, the object will not be examined for collision detection (default = false). 290 *** Setting this member to true really has two effects. First, the object may exist anywhere on 291 *** the map, including where the collision rectangles of other objects are located. Second, the 292 *** object is ignored when other objects are performing their collision detection. This property 293 *** is useful for virtual objects or objects with an image but no "physical form" (i.e. ghosts 294 *** that other sprites may walk through). Note that while this member is set to true, the object's 295 *** collision rectangle members are ignored. 296 **/ 297 bool no_collision; 298 299 /** \brief When set to true, objects in the ground object layer will be drawn after the pass objects 300 *** \note This member is only checked for objects that exist in the ground layer. It has no meaning 301 *** for objects in the pass or sky layers. 302 **/ 303 bool draw_on_second_pass; 304 305 // -------------------- Public methods 306 307 VirtualSprite(); 308 309 ~VirtualSprite(); 310 311 //! \brief Updates the virtual object's position if it is moving, otherwise does nothing. 312 virtual void Update(); 313 314 //! \brief Draws a dialogue icon over the virtual sprite if it has to. 315 virtual void Draw(); 316 317 //! \brief Draws the selection image 318 virtual void DrawSelection()=0; 319 320 /** \name Lua Access Functions 321 *** These functions are specifically written for Lua binding, to enable Lua to access the 322 *** members of this class. 323 **/ 324 //@{ 325 /** \note This method takes into account the current direction when setting the new direction 326 *** in the case of diagonal movement. For example, if the sprite is currently facing north 327 *** and this function indicates that the sprite should move northwest, it will face north 328 *** during the northwest movement. 329 **/ 330 void SetDirection(uint16 dir); 331 SetMovementSpeed(float speed)332 void SetMovementSpeed(float speed) 333 { movement_speed = speed; } 334 GetDirection()335 uint16 GetDirection() const 336 { return direction; } 337 GetMovementSpeed()338 float GetMovementSpeed() const 339 { return movement_speed; } 340 341 void SetFacePortrait(std::string pn); 342 //@} 343 344 /** \brief This method will save the state of a sprite. 345 *** Attributes saved: direction, speed, moving state, name, current action. 346 **/ 347 virtual void SaveState(); 348 349 /** \brief This method will load the saved state of a sprite. 350 *** Attributes loaded: direction, speed, moving state, name, current action. 351 *** \return false if there was no saved state, true otherwise. 352 **/ 353 virtual bool LoadState(); 354 355 //! \brief Examines all dialogue owned by the sprite and sets the appropriate value of VirtualSprite#seen_all_dialogue 356 //void UpdateSeenDialogue(); 357 358 //! \brief Examines all dialogue owned by the sprite and sets the appropriate value of VirtualSprite#has_active_dialogue 359 //void UpdateActiveDialogue(); 360 361 /** \name Dialogue control methods 362 *** These methods are used to add and control which dialogue should the sprite speak. 363 **/ 364 //@{ 365 //void AddDialogue(MapDialogue* md); 366 367 //bool HasDialogue() const 368 //{ if(dialogues.size() > 0) return has_active_dialogue; else return false; } 369 370 //MapDialogue* GetCurrentDialogue() const 371 //{ return dialogues[_current_dialogue]; } 372 373 //void SetDialogue(const int16 dialogue) 374 //{ if (static_cast<uint16>(dialogue) >= dialogues.size()) return; else _current_dialogue = dialogue; } 375 376 //void NextDialogue() 377 //{ do { _current_dialogue++; if (static_cast<uint16>(_current_dialogue) >= dialogues.size()) _current_dialogue = 0; } 378 // while (dialogues[_current_dialogue]->IsActive() == false); } 379 380 //int16 GetNumDialogues() const 381 //{ return dialogues.size(); } 382 383 //void ShowDialogueIcon(bool state) 384 //{ _show_dialogue_icon = state; } 385 386 //bool IsShowingDialogueIcon() const 387 //{ return _show_dialogue_icon; } 388 //@} 389 390 /** \brief Adds a new action for the sprite to process onto the end of the sprite's action list 391 *** \param act A pointer to the instantiated SpriteAction object to use 392 **/ 393 //void AddAction(SpriteAction* act) 394 //{ act->SetSprite(this); actions.push_back(act); } 395 396 /** \brief This static class function returns the opposite direction of the direction given in parameter. 397 *** \note This is mostly used as an helper function to make sprites face each other. 398 **/ 399 static uint16 CalculateOppositeDirection(const uint16 direction); 400 401 /** \brief Computes the full floating-point location coordinates of the object 402 *** \return The full x or y coordinate location of the object 403 *** 404 *** Since an object's position is stored as an integer component and an offset component, this 405 *** method simply returns a single floating point value representing the full x and y positions 406 *** of the object in a single variable. 407 **/ 408 //@{ ComputeXLocation()409 float ComputeXLocation() const 410 { return (static_cast<float>(x_position) + x_offset); } 411 ComputeYLocation()412 float ComputeYLocation() const 413 { return (static_cast<float>(y_position) + y_offset); } 414 ComputeDrawXLocation()415 float ComputeDrawXLocation() const 416 { return (static_cast<float>(x_position) - img_half_width) / X_POS_FACTOR + x_offset; } 417 ComputeDrawYLocation()418 float ComputeDrawYLocation() const 419 { return (static_cast<float>(y_position) - img_height) / Y_POS_FACTOR + y_offset; } 420 ComputeHoverArea()421 QRectF ComputeHoverArea() const 422 { return QRectF(ComputeDrawXLocation(), ComputeDrawYLocation(), img_half_width, img_height/2); } 423 IsInHoverArea(float x,float y)424 bool IsInHoverArea(float x, float y) const 425 { return ComputeHoverArea().contains( QPointF(x,y) ); } 426 //@} 427 428 /** \brief Sets the sprite's direction to a random value 429 *** This function is used mostly for the ActionRandomMove class. 430 **/ 431 void SetRandomDirection(); 432 433 void SetObjectID(int16 id = 0) 434 { object_id = id; } 435 SetContext(uint32 ctxt)436 void SetContext(uint32 ctxt) 437 { context = ctxt; } 438 SetXPosition(uint16 x,float offset)439 void SetXPosition(uint16 x, float offset) 440 { x_position = x; x_offset = offset; } 441 SetYPosition(uint16 y,float offset)442 void SetYPosition(uint16 y, float offset) 443 { y_position = y; y_offset = offset; } 444 SetImgHalfWidth(float width)445 void SetImgHalfWidth(float width) 446 { img_half_width = width; } 447 SetImgHeight(float height)448 void SetImgHeight(float height) 449 { img_height = height; } 450 SetCollHalfWidth(float collision)451 void SetCollHalfWidth(float collision) 452 { coll_half_width = collision; } 453 SetCollHeight(float collision)454 void SetCollHeight(float collision) 455 { coll_height = collision; } 456 SetUpdatable(bool update)457 void SetUpdatable(bool update) 458 { updatable = update; } 459 SetVisible(bool vis)460 void SetVisible(bool vis) 461 { visible = vis; } 462 SetNoCollision(bool coll)463 void SetNoCollision(bool coll) 464 { no_collision = coll; } 465 SetDrawOnSecondPass(bool pass)466 void SetDrawOnSecondPass(bool pass) 467 { draw_on_second_pass = pass; } 468 GetObjectID()469 int16 GetObjectID() const 470 { return object_id; } 471 GetContext()472 uint32 GetContext() const 473 { return context; } 474 GetXPosition(uint16 & x,float & offset)475 void GetXPosition(uint16 &x, float &offset) const 476 { x = x_position; offset = x_offset; } 477 GetYPosition(uint16 & y,float & offset)478 void GetYPosition(uint16 &y, float &offset) const 479 { y = y_position; offset = y_offset; } 480 GetImgHalfWidth()481 float GetImgHalfWidth() const 482 { return img_half_width; } 483 GetImgHeight()484 float GetImgHeight() const 485 { return img_height; } 486 GetCollHalfWidth()487 float GetCollHalfWidth() const 488 { return coll_half_width; } 489 GetCollHeight()490 float GetCollHeight() const 491 { return coll_height; } 492 IsUpdatable()493 bool IsUpdatable() const 494 { return updatable; } 495 IsVisible()496 bool IsVisible() const 497 { return visible; } 498 IsNoCollision()499 bool IsNoCollision() const 500 { return no_collision; } 501 IsDrawOnSecondPass()502 bool IsDrawOnSecondPass() const 503 { return draw_on_second_pass; } 504 GetType()505 uint8 GetType() const 506 { return _object_type; } 507 508 protected: 509 //! \brief This holds the the type of sprite this is. 510 uint8 _object_type; 511 512 //! \brief Selected image for sprite has been selected 513 hoa_video::StillImage _selected_image; 514 515 }; // class VirtualSprite : public MapObject 516 517 518 /** **************************************************************************** 519 *** \brief A mobile map object with which the player can interact with. 520 *** 521 *** Map sprites are animate, mobile, living map objects. Although there is 522 *** but this single class to represent all the map sprites in the game, they can 523 *** divided into types such as NPCs, friendly creatures, and enemies. The fact 524 *** that there is only one class for representing several sprite types is the 525 *** reason why many of the class members are pointers. For example, we don't 526 *** need dialogue for a dog sprite. 527 *** ***************************************************************************/ 528 class MapSprite : public VirtualSprite { 529 public: 530 //! \brief Holds the previous value of VirtualSprite#moving from the last call to MapSprite#Update(). 531 bool was_moving; 532 533 //! \brief Set to true if the sprite has running animations loaded 534 bool has_running_anim; 535 536 /** \brief The sound that will play when the sprite walks. 537 *** This member references the MapMode#_map_sounds vector as the sound to play. If this member 538 *** is less than zero, no sound is played when the object is walking. 539 **/ 540 int8 walk_sound; 541 542 //! \brief The index to the animations vector containing the current sprite image to display 543 uint8 current_animation; 544 545 /** \brief A vector containing all the sprite's various animations. 546 *** The first four entries in this vector are the walking animation frames. 547 *** They are ordered from index 0 to 3 as: down, up, left, right. Additional 548 *** animations may follow. 549 **/ 550 std::vector<hoa_video::AnimatedImage> animations; 551 552 /** \name Saved state attributes 553 *** These attributes are used to save and load the state of a VirtualSprite 554 **/ 555 //@{ 556 //bool _saved_was_moving; 557 //int8 _saved_walk_sound; 558 //uint8 _saved_current_animation; 559 //@} 560 561 // -------------------------------- Methods -------------------------------- 562 563 MapSprite(); 564 565 ~MapSprite(); 566 567 /** \brief Loads the image containing the standard animations for the sprite 568 *** \param filename The name of the image file holding the standard walking animations 569 *** \return False if there was a problem loading the sprite. 570 **/ 571 bool LoadStandardAnimations(std::string filename); 572 573 /** \brief Loads the image containing the running animations for the sprite 574 *** \param filename The name of the image file 575 *** \return False if the animations were not created successfully. 576 **/ 577 bool LoadRunningAnimations(std::string filename); 578 579 //! \brief Updates the sprite's position and state. 580 virtual void Update(); 581 582 //! \brief Draws the sprite frame in the appropriate position on the screen, if it is visible. 583 virtual void Draw(); 584 585 //! \brief Draws the selection image 586 virtual void DrawSelection(); 587 588 /** \name Lua Access Functions 589 *** These functions are specifically written for Lua binding, to enable Lua to access the 590 *** members of this class. 591 **/ 592 //@{ SetName(std::string na)593 void SetName(std::string na) 594 { name = hoa_utils::MakeUnicodeString(na); } 595 SetWalkSound(int8 sound)596 void SetWalkSound(int8 sound) 597 { walk_sound = sound; } 598 SetCurrentAnimation(uint8 anim)599 void SetCurrentAnimation(uint8 anim) 600 { current_animation = anim; } 601 GetWalkSound()602 int8 GetWalkSound() const 603 { return walk_sound; } 604 GetCurrentAnimation()605 uint8 GetCurrentAnimation() const 606 { return current_animation; } 607 //@} 608 609 /** \brief This method will save the state of a sprite. 610 *** Attributes saved: direction, speed, moving state, name, current action, 611 *** current animation, current walk sound. 612 **/ 613 //virtual void SaveState(); 614 615 /** \brief This method will load the saved state of a sprite. 616 *** Attributes loaded: direction, speed, moving state, name, current action, 617 *** current animation, current walk sound. 618 *** \return false if there was no saved state, true otherwise. 619 **/ 620 //virtual bool LoadState(); 621 }; // class MapSprite : public VirtualSprite 622 623 } // namespace hoa_map 624 625 #endif // __SPRITES_HEADER__ 626