butler and door updated from CK 8.4
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@192 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -39,8 +39,10 @@ char not_about_to_fall;
|
|||||||
objects[o].ai.butler.movedir = RIGHT;
|
objects[o].ai.butler.movedir = RIGHT;
|
||||||
objects[o].ai.butler.animtimer = 0;
|
objects[o].ai.butler.animtimer = 0;
|
||||||
objects[o].canbezapped = 1; // will stop bullets but are not harmed
|
objects[o].canbezapped = 1; // will stop bullets but are not harmed
|
||||||
|
//objects[o].inhibitfall = 1;
|
||||||
objects[o].needinit = 0;
|
objects[o].needinit = 0;
|
||||||
objects[o].x -= 16;
|
//objects[o].x -= 16;
|
||||||
|
objects[o].x -= 4;
|
||||||
}
|
}
|
||||||
// push keen
|
// push keen
|
||||||
if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie)
|
if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie)
|
||||||
@@ -87,7 +89,6 @@ char not_about_to_fall;
|
|||||||
{ // move left
|
{ // move left
|
||||||
|
|
||||||
not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)-BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_LEFT_FRAME].ysize)][BUP];
|
not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)-BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_LEFT_FRAME].ysize)][BUP];
|
||||||
//not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_LEFT_FRAME].ysize)].solidfall;
|
|
||||||
objects[o].sprite = BUTLER_WALK_LEFT_FRAME + objects[o].ai.butler.frame;
|
objects[o].sprite = BUTLER_WALK_LEFT_FRAME + objects[o].ai.butler.frame;
|
||||||
if (!objects[o].blockedl && not_about_to_fall)
|
if (!objects[o].blockedl && not_about_to_fall)
|
||||||
{
|
{
|
||||||
@@ -109,7 +110,6 @@ char not_about_to_fall;
|
|||||||
{ // move right
|
{ // move right
|
||||||
|
|
||||||
not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].xsize+BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].ysize)][BUP];
|
not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].xsize+BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].ysize)][BUP];
|
||||||
//not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].xsize+BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].ysize)].solidfall;
|
|
||||||
objects[o].sprite = BUTLER_WALK_RIGHT_FRAME + objects[o].ai.butler.frame;
|
objects[o].sprite = BUTLER_WALK_RIGHT_FRAME + objects[o].ai.butler.frame;
|
||||||
if (!objects[o].blockedr && not_about_to_fall)
|
if (!objects[o].blockedr && not_about_to_fall)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "../keen.h"
|
#include "../keen.h"
|
||||||
|
|
||||||
#include "../include/enemyai.h"
|
#include "door.h"
|
||||||
|
|
||||||
// "AI" for the door object (to do the animation when a door
|
// "AI" for the door object (to do the animation when a door
|
||||||
// opens, the door tiles are removed and replaced with a sprite
|
// opens, the door tiles are removed and replaced with a sprite
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#define DOOR_OPEN_SPEED 10
|
#define DOOR_OPEN_SPEED 10
|
||||||
|
|
||||||
void door_ai(int o)
|
/*void door_ai(int o)
|
||||||
{
|
{
|
||||||
if (objects[o].needinit)
|
if (objects[o].needinit)
|
||||||
{
|
{
|
||||||
@@ -30,4 +30,29 @@ void door_ai(int o)
|
|||||||
else objects[o].ai.door.distance_traveled++;
|
else objects[o].ai.door.distance_traveled++;
|
||||||
objects[o].ai.door.timer = 0;
|
objects[o].ai.door.timer = 0;
|
||||||
} else objects[o].ai.door.timer++;
|
} else objects[o].ai.door.timer++;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void door_ai(int o, char DoorOpenDir)
|
||||||
|
{
|
||||||
|
if (objects[o].needinit)
|
||||||
|
{
|
||||||
|
objects[o].ai.door.timer = 0;
|
||||||
|
sprites[objects[o].sprite].ysize = 32;
|
||||||
|
objects[o].inhibitfall = 1;
|
||||||
|
objects[o].needinit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objects[o].ai.door.timer > DOOR_OPEN_SPEED)
|
||||||
|
{
|
||||||
|
// TODO: Create a flag for mods in which the door can be opened in another direction
|
||||||
|
/*if (DoorOpenDir==DOWN)*/ objects[o].y += (1<<CSF);
|
||||||
|
if (!--sprites[objects[o].sprite].ysize)
|
||||||
|
{
|
||||||
|
delete_object(o);
|
||||||
|
}
|
||||||
|
objects[o].ai.door.timer = 0;
|
||||||
|
}
|
||||||
|
else objects[o].ai.door.timer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
src/ai/door.h
Normal file
19
src/ai/door.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* door.h
|
||||||
|
*
|
||||||
|
* Created on: 29.07.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DOOR_H_
|
||||||
|
#define DOOR_H_
|
||||||
|
|
||||||
|
// direction in the where the door goes, when door opened. Usually down
|
||||||
|
#define RIGHT 0
|
||||||
|
#define LEFT 1
|
||||||
|
#define UP 2
|
||||||
|
#define DOWN 3
|
||||||
|
|
||||||
|
void delete_object(int o);
|
||||||
|
|
||||||
|
#endif /* DOOR_H_ */
|
||||||
@@ -384,6 +384,15 @@ short tilefix=0;
|
|||||||
objects[o].sprite = doorsprite;
|
objects[o].sprite = doorsprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void delete_object(int o)
|
||||||
|
{
|
||||||
|
if (objects[o].exists)
|
||||||
|
{
|
||||||
|
objects[o].exists = 0;
|
||||||
|
//if (o+1==highest_objslot) highest_objslot--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// checks if score is > than "extra life at" and award 1-UPs when appropriate
|
// checks if score is > than "extra life at" and award 1-UPs when appropriate
|
||||||
void extralifeat(int cp)
|
void extralifeat(int cp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ int i;
|
|||||||
case OBJ_BUTLER: butler_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
case OBJ_BUTLER: butler_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
||||||
case OBJ_TANK: tank_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
case OBJ_TANK: tank_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
||||||
case OBJ_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break;
|
case OBJ_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break;
|
||||||
case OBJ_DOOR: door_ai(i); break;
|
case OBJ_DOOR: door_ai(i, pCKP->Control.levelcontrol.cepvars.DoorOpenDir); break;
|
||||||
case OBJ_ICECHUNK: icechunk_ai(i); break;
|
case OBJ_ICECHUNK: icechunk_ai(i); break;
|
||||||
case OBJ_ICEBIT: icebit_ai(i); break;
|
case OBJ_ICEBIT: icebit_ai(i); break;
|
||||||
case OBJ_TELEPORTER: teleporter_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_TELEPORTER: teleporter_ai(i, pCKP->Control.levelcontrol); break;
|
||||||
|
|||||||
@@ -64,6 +64,16 @@ struct stLevelControl
|
|||||||
|
|
||||||
// as long as we only have POD
|
// as long as we only have POD
|
||||||
stLevelControl() { memset(this, 0, sizeof(stLevelControl)); }
|
stLevelControl() { memset(this, 0, sizeof(stLevelControl)); }
|
||||||
|
|
||||||
|
// stuff for custom episode's options
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char DoorOpenDir;
|
||||||
|
char pShotSpeed;
|
||||||
|
char VortDieDoFade;
|
||||||
|
char vgatiles;
|
||||||
|
char vgasprites;
|
||||||
|
} cepvars;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
|
|||||||
void butler_ai(int o, bool hardmode);
|
void butler_ai(int o, bool hardmode);
|
||||||
void tank_ai(int o, bool hardmode);
|
void tank_ai(int o, bool hardmode);
|
||||||
void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
|
void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
|
||||||
void door_ai(int o);
|
|
||||||
void icechunk_ai(int o);
|
void icechunk_ai(int o);
|
||||||
void icebit_ai(int o);
|
void icebit_ai(int o);
|
||||||
|
void door_ai(int o, char DoorOpenDir);
|
||||||
void teleporter_ai(int o, stLevelControl levelcontrol);
|
void teleporter_ai(int o, stLevelControl levelcontrol);
|
||||||
void rope_ai(int o);
|
void rope_ai(int o);
|
||||||
// ep2
|
// ep2
|
||||||
|
|||||||
Reference in New Issue
Block a user