/* 
 * XEvil(TM) Copyright (C) 1994,2000 Steve Hardt and Michael Judge
 * http://www.xevil.com
 * satan@xevil.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * 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 for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program, the file "gpl.txt"; if not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA, or visit http://www.gnu.org.
 */


#if X11
#include "gen_xpm/bomb/bomb_25.xpm"
#include "gen_xpm/bomb/bomb_25b.xpm"
#include "gen_xpm/bomb/bomb_26.xpm"
#include "gen_xpm/bomb/bomb_27.xpm"
#include "gen_xpm/bomb/bomb_28.xpm"
#include "gen_xpm/bomb/bomb_29.xpm"
#include "gen_xpm/bomb/bomb_30.xpm"
#include "gen_xpm/bomb/bomb_31.xpm"
#endif



// Defines
#define BOMB_TIME 10
#define BOMB_FRAME_INACTIVE 6
#define BOMB_FRAME_ACTIVE 5
#define BOMB_EXPLOSION_RADIUS 100
#define BOMB_EXPLOSION_DAMAGE_MAX 350



Size Bomb::get_size_max() {
  return context.itemContext.fallingContext.movingContext.physicalContext.sizeMax;
} 



PhysicalP Bomb::create(void *,WorldP w,LocatorP l,const Pos &pos) {
  PhysicalP ret = new Bomb(w,l,pos);
  assert(ret);
  return ret;
}



static void bomb_get_item_info(Boolean &isItem,Boolean &isWeapon,
                               CMN_BITS_ID &iconId) {
  isItem = True;
  isWeapon = False;
#if WIN32
  iconId = IDB_HIBOMB6;
#endif
#if X11
  iconId = 0;
#endif
}



AnimatedXdata Bomb::xdata;



const AnimatedContext Bomb::context = 
 { /** AnimatedContext **/
  { /** ItemContext **/
    False, /* persists */
    80, /* coolness */
    0, /*item use sound*/  // The Explosion object makes the noise.
    { /** FallingContext **/
      {/** MovingContext **/
#if X11
        "black",False,
        "white",True,
#endif
#if WIN32        
        RGB(0,0,0),False, 
        RGB(0,0,0),True,
#endif
        
        /* animMax */
        {0,0,0,0,0,0,
         0,
         0,0,
         0,
         0,0,
         0,
         0,0,
         0,
         0,0,
         0,
         0,0,
         0,0,
         0,0,
         2,2,2,2,2,2,1,},

        /* sizes */
        {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
         {0,0},
         {0,0},{0,0},
         {0,0},
         {0,0},{0,0},
         {0,0},
         {0,0},{0,0},
         {0,0},
         {0,0},{0,0},
         {0,0},
         {0,0},{0,0},
         {0,0},{0,0},
         {0,0},{0,0},
         {14,13},{14,13},{14,13},{14,13},{14,13},{14,13},{14,13},
        },
	
        /* offsets */
        {{0}},
        
        /* pixmapBits */
        {{0},{0},{0},{0},{0},{0},
         {0},
         {0},{0},
         {0},
         {0},{0},
         {0},
         {0},{0},
         {0},
         {0},{0},
         {0},
         {0},{0},
         {0},{0},
         {0},{0},
         {CMN_ID(bomb_25,IDB_HIBOMB0),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK)},
         {CMN_ID(bomb_26,IDB_HIBOMB1),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK),},
         {CMN_ID(bomb_27,IDB_HIBOMB2),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK),},
         {CMN_ID(bomb_28,IDB_HIBOMB3),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK),},
         {CMN_ID(bomb_29,IDB_HIBOMB4),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK),},
         {CMN_ID(bomb_30,IDB_HIBOMB5),
          CMN_ID(bomb_25b,IDB_HIBOMBBLK),},
         {CMN_ID(bomb_31,IDB_HIBOMB6)},
        },
        
        /* maskBits */
        {{0}},
  
		{ /** PhysicalContext **/
		  1, /* health */
		  20, /* mass */
		  A_Bomb, /* classId */
		  "bomb", /* clas */
          
		  False, /* transmogifyTarget */
		  False, /* doppelUser */
		  False, /* potentialHuman */
		  False, /* potentialEnemy */
		  0, /* enemyWeight */
		  False, /* potentialWeapon */
		  True, /* potentialOtherItem */
		  .0006f, /* objectWorldPercent */
		  0, /* levelMaxTimes */
		  {14,13}, /* sizeMax */
		  Bomb::create, /* create */
		  False, /* statsCreations */
		  True, /* statsUses */
		  False, /* statsDeaths */
		  Bomb::get_stats, /* get_stats */
          NULL, /* arg */
          Bomb::init_x, /* init_x */
          Bomb::create_from_stream, /* create_from_stream */
          bomb_get_item_info, /* get_item_info */
		},
        True, /* hiRes */
        0, /* offsetGenerator */
        0, /* transformOverride */
        True, /* useXPM */
      },
    },
  },
};
