source: golgotha/src/golg/objs/armor.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.7 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "player.hh"
10#include "objs/def_object.hh"
11#include "lisp/li_class.hh"
12#include "lisp/li_init.hh"
13#include "controller.hh"
14
15
16static li_float_class_member damage_multiplier_fraction("damage_multiplier_fraction"),
17  spin_speed("spin_speed");
18
19
20
21li_object *g1_armor_occupy(li_object *o, li_environment *env)
22{
23  g1_dynamic_object_class *me=g1_dynamic_object_class::get(li_first(o));
24
25  if (me->g1_object_class::occupy_location())
26  {
27    g1_player_man.get(me->player_num)->damage_multiplier() *= damage_multiplier_fraction();
28    return li_true_sym;
29  }
30  return 0;
31}
32
33
34li_object *g1_armor_unoccupy(li_object *o, li_environment *env)
35{
36  g1_dynamic_object_class *me=g1_dynamic_object_class::get(li_first(o));
37  me->g1_object_class::unoccupy_location();
38  g1_player_man.get(me->player_num)->damage_multiplier() /= damage_multiplier_fraction();
39  return 0;
40}
41
42li_object *g1_armor_think(li_object *o, li_environment *env)
43{
44  g1_dynamic_object_class *me=g1_dynamic_object_class::get(li_first(o));
45  me->mini_objects[0].rotation.z+=spin_speed();
46  return 0;
47}
48
49
50
51li_object *g1_armor_change_player_num(li_object *o, li_environment *env)
52{
53  g1_dynamic_object_class *me=g1_dynamic_object_class::get(li_first(o));
54  int new_team=li_int::get(li_second(o))->value();
55
56  if (new_team!=me->player_num)
57  {
58    g1_player_man.get(new_team)->damage_multiplier()*=damage_multiplier_fraction();
59    g1_player_man.get(me->player_num)->damage_multiplier()/=damage_multiplier_fraction();
60
61
62    if (new_team==g1_player_man.local_player && g1_current_controller.get())
63      g1_current_controller->add_spin_event("powerup_shields", 0);
64
65    if (me->player_num==g1_player_man.local_player && g1_current_controller.get())
66      g1_current_controller->add_spin_event("powerup_shields", 1);
67
68    me->g1_object_class::change_player_num(new_team);
69  }
70
71  return 0;
72}
73
74li_automatic_add_function(g1_armor_occupy, "armor_building_occupy_location");
75li_automatic_add_function(g1_armor_unoccupy, "armor_building_unoccupy_location");
76li_automatic_add_function(g1_armor_think, "armor_building_think");
77li_automatic_add_function(g1_armor_change_player_num, "armor_building_change_player_num");
Note: See TracBrowser for help on using the repository browser.