/*
 * xrick/src/e_bonus.c
 *
 * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
 *
 * The use and distribution terms for this software are contained in the file
 * named README, which can be found in the root of this distribution. By
 * using this software in any fashion, you are agreeing to be bound by the
 * terms of this license.
 *
 * You must not remove this notice, or any other, from this software.
 */

#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_bonus.h"

#include "e_rick.h"
#include "maps.h"

#ifdef IIGS
#pragma noroot
segment "e";
#endif

/*
 * Entity action
 *
 * ASM 242C
 */
void
e_bonus_action(ent_t *pEnt)
{
#define seq c1

  if (pEnt->seq == 0) {
    if (e_rick_boxtest(pEnt)) {
      game_score += 500;
	  game_status_dirty = 1;
#ifdef ENABLE_SOUND
      syssnd_play(WAV_BONUS, 1);
#endif
      map_marks[pEnt->mark].ent |= MAP_MARK_NACT;
      pEnt->seq = 1;
      pEnt->sprite = 0xad;
      pEnt->front = TRUE;
      pEnt->y -= 0x08;
    }
  }

  else if (pEnt->seq > 0 && pEnt->seq < 10) {
    pEnt->seq++;
    pEnt->y -= 2;
  }

  else {
    pEnt->n = 0;
  }
}


/* eof */


