Last change
on this file since 555 was
555,
checked in by Sam Hocevar, 11 years ago
|
ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.
|
File size:
1.5 KB
|
Rev | Line | |
---|
[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
[494] | 4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
[56] | 5 | * |
---|
| 6 | * This software was released into the Public Domain. As with most public |
---|
[555] | 7 | * domain software, no warranty is made or implied by Crack dot Com, by |
---|
| 8 | * Jonathan Clark, or by Sam Hocevar. |
---|
[56] | 9 | */ |
---|
| 10 | |
---|
[555] | 11 | #if defined HAVE_CONFIG_H |
---|
| 12 | # include "config.h" |
---|
| 13 | #endif |
---|
[56] | 14 | |
---|
[512] | 15 | #include "common.h" |
---|
| 16 | |
---|
[481] | 17 | #include "lisp.h" |
---|
| 18 | #include "lisp_gc.h" |
---|
| 19 | #include "compiled.h" |
---|
| 20 | #include "objects.h" |
---|
| 21 | #include "level.h" |
---|
| 22 | #include "game.h" |
---|
| 23 | #include "jrand.h" |
---|
| 24 | #include "clisp.h" |
---|
[2] | 25 | |
---|
| 26 | enum { un_offable }; // vars |
---|
| 27 | |
---|
| 28 | void *sensor_ai() |
---|
| 29 | { |
---|
| 30 | game_object *o=current_object,*b; |
---|
| 31 | if (o->aistate()==0) // turned off, what for player to enter |
---|
| 32 | { |
---|
| 33 | if (player_list->next) // find closest player |
---|
| 34 | b=current_level->attacker(current_object); |
---|
| 35 | else b=player_list->focus; |
---|
| 36 | if (abs(b->x-o->x)<o->xvel() && abs(b->y-o->y)<o->yvel()) // inside area? |
---|
| 37 | { |
---|
| 38 | if (!o->hp()) |
---|
| 39 | o->set_aistate(1); |
---|
| 40 | else |
---|
| 41 | o->set_aistate(o->hp()); |
---|
[124] | 42 | o->set_state((character_state)S_blocking); |
---|
[2] | 43 | } else if (o->state!=stopped) |
---|
[124] | 44 | o->set_state(stopped); |
---|
[2] | 45 | } else if (!o->lvars[un_offable]) |
---|
| 46 | { |
---|
| 47 | if (!o->hp()) |
---|
| 48 | { |
---|
| 49 | if (player_list->next) |
---|
| 50 | b=current_level->attacker(current_object); |
---|
| 51 | else b=player_list->focus; |
---|
| 52 | if (abs(o->x-b->x)>o->xacel() || abs(o->y-b->y)>o->yacel()) |
---|
| 53 | o->set_aistate(0); |
---|
| 54 | } else o->set_aistate(o->aistate()-1); |
---|
| 55 | } |
---|
| 56 | return true_symbol; |
---|
| 57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.