00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022
00023 #include <iostream>
00024 #include <algorithm>
00025
00026 #include "SDL_mouse.h"
00027 #include "cheat.h"
00028 #include "exult.h"
00029 #include "gamewin.h"
00030 #include "gameclk.h"
00031 #include "gamemap.h"
00032 #include "party.h"
00033 #include "Configuration.h"
00034 #include "game.h"
00035 #include "actors.h"
00036 #include "mouse.h"
00037 #include "browser.h"
00038 #include "soundtest.h"
00039 #include "cheat_screen.h"
00040 #include "Gump_manager.h"
00041 #include "Gump.h"
00042 #include "drag.h"
00043 #include "effects.h"
00044
00045 #ifdef USE_EXULTSTUDIO
00046 #include "server.h"
00047 #include "servemsg.h"
00048
00049 #ifdef WIN32
00050 #ifndef WIN32_LEAN_AND_MEAN
00051 #define WIN32_LEAN_AND_MEAN
00052 #endif
00053 #include <windows.h>
00054 #endif // WIN32
00055
00056 #endif //USE_EXULTSTUDIO
00057
00058 #ifndef UNDER_CE
00059 using std::cout;
00060 using std::endl;
00061 using std::strcpy;
00062 using std::strcat;
00063 #endif
00064
00065 Cheat cheat;
00066
00067
00068 Cheat::Cheat() {
00069 enabled = false;
00070
00071 god_mode = false;
00072 wizard_mode = false;
00073 map_editor = false;
00074 tile_grid = false;
00075 edit_mode = move;
00076 edit_lift = 0;
00077 edit_shape = edit_frame = edit_chunknum = 0;
00078 infravision = false;
00079 pickpocket = false;
00080 grab_actor = true;
00081
00082 browser = NULL;
00083 tester = NULL;
00084 }
00085
00086 Cheat::~Cheat() {
00087 if (browser)
00088 delete browser;
00089 if (tester)
00090 delete tester;
00091 if (cscreen)
00092 delete cscreen;
00093 }
00094
00095 void Cheat::init (void) {
00096 enabled = false;
00097 std::string cheating;
00098 config->value("config/gameplay/cheat",cheating,"no");
00099 if (cheating == "yes")
00100 enabled = true;
00101 }
00102
00103 void Cheat::finish_init (void) {
00104 gwin = Game_window::get_instance();
00105 eman = gwin->get_effects();
00106
00107 browser = new ShapeBrowser();
00108 tester = new SoundTester();
00109 cscreen = new CheatScreen();
00110
00111 if (enabled)
00112 cout << "Cheats enabled." << endl;
00113 }
00114
00115
00116 void Cheat::set_enabled (bool en) {
00117 enabled = en;
00118 std::string cheating;
00119 if(enabled)
00120 cheating = "yes";
00121 else
00122 cheating = "no";
00123 config->set("config/gameplay/cheat",cheating,true);
00124 }
00125
00126 void Cheat::toggle_god (void) {
00127 if (!enabled) return;
00128
00129 god_mode = !god_mode;
00130 if (god_mode)
00131 {
00132 eman->center_text("God Mode Enabled");
00133 Actor *party[9];
00134 int cnt = gwin->get_party(party, 1);
00135 for (int i = 0; i < cnt; i++)
00136 party[i]->set_attack_mode(Actor::nearest);
00137 }
00138 else
00139 eman->center_text("God Mode Disabled");
00140 }
00141
00142 void Cheat::toggle_wizard (void) {
00143 if (!enabled) return;
00144
00145 wizard_mode = !wizard_mode;
00146 if (wizard_mode)
00147 eman->center_text("Archwizard Mode Enabled");
00148 else
00149 eman->center_text("Archwizard Mode Disabled");
00150 }
00151
00152 void Cheat::toggle_map_editor (void) {
00153 if (!enabled) return;
00154
00155 map_editor = !map_editor;
00156 if (map_editor)
00157 {
00158 eman->center_text("Map Editor Mode Enabled");
00159
00160 gwin->set_time_stopped(-1);
00161 #ifdef USE_EXULTSTUDIO
00162 if (!gwin->paint_eggs)
00163 {
00164 gwin->paint_eggs = 1;
00165 gwin->paint();
00166 }
00167 if (client_socket < 0 &&
00168 !gwin->get_win()->is_fullscreen())
00169 {
00170 char cmnd[256];
00171 strcpy(cmnd, "exult_studio -x");
00172 std::string data_path;
00173 config->value("config/disk/data_path",data_path,EXULT_DATADIR);
00174 strcat(cmnd, data_path.c_str());
00175 strcat(cmnd, " -g");
00176 std::string gamenamestr = Game::get_gametitle();
00177 strcat(cmnd, gamenamestr.c_str());
00178 strcat(cmnd, " &");
00179 cout << "Executing: " << cmnd << endl;
00180 #ifndef WIN32
00181 int ret = system(cmnd);
00182 if (ret == 127 || ret == -1)
00183 cout << "Couldn't run Exult Studio" << endl;
00184 #elif !(defined(UNDER_CE))
00185 PROCESS_INFORMATION pi;
00186 STARTUPINFO si;
00187
00188 std::memset (&si, 0, sizeof(si));
00189 si.cb = sizeof(si);
00190
00191 int ret = CreateProcess (NULL, cmnd, NULL, NULL,
00192 FALSE, 0,
00193 NULL, NULL, &si, &pi);
00194 if (!ret) cout << "Couldn't run Exult Studio" << endl;
00195 #endif
00196 }
00197 #endif
00198 }
00199 else
00200 {
00201 clear_selected();
00202 eman->center_text("Map Editor Mode Disabled");
00203
00204 gwin->set_time_stopped(0);
00205 }
00206 }
00207
00208 void Cheat::toggle_tile_grid (void) {
00209 if (!enabled) return;
00210 tile_grid = !tile_grid;
00211 gwin->set_all_dirty();
00212 }
00213
00214 void Cheat::set_edit_lift(int lift) {
00215 if (!enabled) return;
00216 edit_lift = lift;
00217 gwin->set_all_dirty();
00218 }
00219
00220 void Cheat::set_edit_shape(int sh, int fr) {
00221 edit_shape = sh;
00222 edit_frame = fr;
00223 }
00224
00225 void Cheat::toggle_infravision (void) {
00226 if (!enabled) return;
00227
00228 infravision = !infravision;
00229 if (infravision) {
00230 eman->center_text("Infravision Enabled");
00231 gwin->get_pal()->set(0);
00232 } else
00233 eman->center_text("Infravision Disabled");
00234 }
00235
00236 void Cheat::toggle_pickpocket (void) {
00237 if (!enabled) return;
00238
00239 pickpocket = !pickpocket;
00240 if (pickpocket) {
00241 eman->center_text("Pick Pocket Enabled");
00242 gwin->get_pal()->set(0);
00243 } else
00244 eman->center_text("Pick Pocket Disabled");
00245 }
00246
00247 void Cheat::toggle_hack_mover (void) {
00248 if (!enabled) return;
00249
00250 hack_mover = !hack_mover;
00251 if (hack_mover) {
00252 eman->center_text("Hack mover Enabled");
00253 } else {
00254 eman->center_text("Hack mover Disabled");
00255 }
00256 }
00257
00258 void Cheat::change_gender (void) const {
00259 if (!enabled) return;
00260
00261 if (gwin->get_main_actor()->get_type_flag(Actor::tf_sex)) {
00262 gwin->get_main_actor()->clear_type_flag(Actor::tf_sex);
00263 eman->center_text("Avatar is now male");
00264 } else {
00265 gwin->get_main_actor()->set_type_flag(Actor::tf_sex);
00266 eman->center_text("Avatar is now female");
00267 }
00268 gwin->set_all_dirty();
00269 }
00270
00271 void Cheat::toggle_eggs (void) const {
00272 if (!enabled) return;
00273
00274 gwin->paint_eggs = !gwin->paint_eggs;
00275 if(gwin->paint_eggs)
00276 eman->center_text("Eggs display enabled");
00277 else
00278 eman->center_text("Eggs display disabled");
00279 gwin->paint();
00280 }
00281
00282 void Cheat::toggle_Petra (void) const {
00283 if (!enabled || (Game::get_game_type() != SERPENT_ISLE)) return;
00284
00285 if (gwin->get_main_actor()->get_flag(Obj_flags::petra))
00286 gwin->get_main_actor()->clear_flag(Obj_flags::petra);
00287 else
00288 gwin->get_main_actor()->set_flag(Obj_flags::petra);
00289 gwin->set_all_dirty();
00290 }
00291
00292 void Cheat::toggle_naked (void) const {
00293 if (!enabled || (Game::get_game_type() != SERPENT_ISLE)) return;
00294
00295 if (gwin->get_main_actor()->get_siflag(Actor::naked))
00296 gwin->get_main_actor()->clear_siflag(Actor::naked);
00297 else
00298 gwin->get_main_actor()->set_siflag(Actor::naked);
00299 gwin->set_all_dirty();
00300 }
00301
00302 void Cheat::change_skin (void) const {
00303 if (!enabled || (Game::get_game_type() != SERPENT_ISLE && !Shape_manager::get_instance()->can_use_multiracial())) return;
00304
00305 int color = gwin->get_main_actor()->get_skin_color();
00306
00307 if (GAME_BG) color = (color+1) %4;
00308 else color = (color+1) %3;
00309
00310 gwin->get_main_actor()->set_skin_color(color);
00311 gwin->set_all_dirty();
00312 }
00313
00314 void Cheat::levelup_party (void) const {
00315 if (!enabled) return;
00316
00317 Actor* party[9];
00318 int level, newexp;
00319 bool leveledup = false;
00320
00321
00322 int cnt = gwin->get_party(party, 1);
00323
00324 for (int i=0; i<cnt; i++) {
00325 level = party[i]->get_level();
00326 if (level < 10) {
00327 leveledup = true;
00328 newexp = 25 * (2 << level);
00329 party[i]->set_property(Actor::exp, newexp);
00330 }
00331 }
00332
00333 if (leveledup) {
00334 eman->center_text("Level up!");
00335 } else {
00336 eman->center_text("Maximum level reached");
00337 }
00338 }
00339
00340 void Cheat::fake_time_period (void) const {
00341 if (!enabled) return;
00342
00343 gwin->get_clock()->fake_next_period();
00344 eman->center_text("Game clock incremented");
00345 }
00346
00347 void Cheat::dec_skip_lift (void) const {
00348 if (!enabled) return;
00349
00350 if (gwin->skip_lift == 16)
00351 gwin->skip_lift = 11;
00352 else
00353 gwin->skip_lift--;
00354 if (gwin->skip_lift < 0)
00355 gwin->skip_lift = 16;
00356 #ifdef DEBUG
00357 cout << "Skip_lift = " << gwin->skip_lift << endl;
00358 #endif
00359 gwin->paint();
00360 }
00361
00362 void Cheat::set_skip_lift (int skip) const {
00363 if (!enabled) return;
00364
00365 if ((skip >= 1 && skip <= 11) || skip == 16)
00366 gwin->skip_lift = skip;
00367 #ifdef DEBUG
00368 cout << "Skip_lift = " << gwin->skip_lift << endl;
00369 #endif
00370 gwin->paint();
00371 }
00372
00373
00374
00375
00376 void Cheat::send_select_status()
00377 {
00378 #ifdef USE_EXULTSTUDIO
00379 if (client_socket >= 0)
00380 {
00381 unsigned char msg[2];
00382 msg[0] = selected.empty() ? 0 : 1;
00383 msg[1] = clipboard.empty() ? 0 : 1;
00384 Exult_server::Send_data(client_socket,
00385 Exult_server::select_status, &msg[0], 2);
00386 }
00387 #endif
00388 }
00389
00390
00391
00392
00393 void Cheat::append_selected(Game_object *obj) {
00394 selected.push_back(obj);
00395 if (selected.size() == 1)
00396 send_select_status();
00397 }
00398
00399
00400
00401
00402 void Cheat::toggle_selected(Game_object *obj) {
00403 if (!obj->get_owner())
00404 gwin->add_dirty(obj);
00405 else
00406 gwin->set_all_dirty();
00407
00408 for (Game_object_vector::iterator it = selected.begin();
00409 it != selected.end(); ++it)
00410 if (*it == obj)
00411 {
00412 selected.erase(it);
00413 if (selected.empty())
00414 send_select_status();
00415 return;
00416 }
00417 selected.push_back(obj);
00418 if (selected.size() == 1)
00419 send_select_status();
00420 }
00421
00422
00423
00424
00425 void Cheat::clear_selected() {
00426 if (selected.empty())
00427 return;
00428 for (Game_object_vector::iterator it = selected.begin();
00429 it != selected.end(); ++it)
00430 {
00431 Game_object *obj = *it;
00432 if (!obj->get_owner())
00433 gwin->add_dirty(obj);
00434 else
00435 gwin->set_all_dirty();
00436 }
00437 selected.clear();
00438 send_select_status();
00439 }
00440
00441
00442
00443
00444 void Cheat::delete_selected() {
00445 if (selected.empty())
00446 return;
00447 while (!selected.empty())
00448 {
00449 Game_object *obj = selected.back();
00450 selected.pop_back();
00451 if (obj->get_owner())
00452 gwin->add_dirty(obj);
00453 else
00454 gwin->set_all_dirty();
00455 obj->remove_this();
00456 }
00457 send_select_status();
00458 }
00459
00460
00461
00462
00463
00464 void Cheat::move_selected(int dx, int dy, int dz) {
00465 if (selected.empty())
00466 return;
00467 std::vector<Tile_coord> tiles;
00468 int lowz = 1000, highz = -1000;
00469
00470 Game_object_vector::iterator it;
00471 for (it = selected.begin(); it != selected.end(); ++it)
00472 {
00473 Game_object *obj = *it;
00474 Game_object *owner = obj->get_outermost();
00475
00476 Tile_coord tile = owner->get_tile();
00477 tiles.push_back(tile);
00478 if (obj == owner)
00479 gwin->add_dirty(obj);
00480 else
00481 gwin->set_all_dirty();
00482 obj->remove_this(true);
00483 if (tile.tz < lowz)
00484 lowz = tile.tz;
00485 if (tile.tz > highz)
00486 highz = tile.tz;
00487 }
00488 if (lowz + dz < 0)
00489 dz = -lowz;
00490 if (highz + dz > 15)
00491 dz = 15 - highz;
00492
00493 for (it = selected.begin(); it != selected.end(); ++it)
00494 {
00495 Tile_coord tile = tiles[it - selected.begin()];
00496 int newtx = (tile.tx + dx + c_num_tiles)%c_num_tiles;
00497 int newty = (tile.ty + dy + c_num_tiles)%c_num_tiles;
00498 int newtz = (tile.tz + dz + 16)%16;
00499 (*it)->set_invalid();
00500 (*it)->move(newtx, newty, newtz);
00501 }
00502 }
00503
00504
00505
00506
00507 class Clip_compare
00508 {
00509 public:
00510 bool operator()(const Game_object *o1, const Game_object *o2)
00511 {
00512 Tile_coord t1 = o1->get_tile(),
00513 t2 = o2->get_tile();
00514 if (t1.tz != t2.tz)
00515 return t1.tz < t2.tz;
00516 else if (t1.ty != t2.ty)
00517 return t1.ty > t2.ty;
00518 else return t1.tx >= t2.tx;
00519 }
00520 };
00521
00522
00523
00524
00525 void Cheat::cut(bool copy)
00526 {
00527 if (selected.empty())
00528 return;
00529 bool clip_was_empty = clipboard.empty();
00530 Game_object_vector::iterator it;
00531
00532 for (it = clipboard.begin(); it != clipboard.end(); ++it)
00533 gwin->delete_object(*it);
00534 clipboard.resize(0);
00535 clipboard.reserve(selected.size());
00536 if (!copy)
00537 gwin->set_all_dirty();
00538
00539 for (it = selected.begin(); it != selected.end(); ++it)
00540 {
00541 Game_object *obj = *it;
00542 Tile_coord t = obj->get_outermost()->get_tile();
00543 if (copy)
00544
00545 obj = gwin->get_map()->create_ireg_object(
00546 obj->get_shapenum(), obj->get_framenum());
00547 else
00548 obj->remove_this(true);
00549
00550 obj->set_shape_pos(t.tx%c_tiles_per_chunk,
00551 t.ty%c_tiles_per_chunk);
00552 obj->set_chunk(t.tx/c_tiles_per_chunk, t.ty/c_tiles_per_chunk);
00553 clipboard.push_back(obj);
00554 }
00555
00556 std::sort(selected.begin(), selected.end(), Clip_compare());
00557 if (!copy)
00558 clear_selected();
00559 else if (clip_was_empty)
00560 send_select_status();
00561 }
00562
00563
00564
00565
00566
00567
00568 static Game_object *Create_object
00569 (
00570 Game_window *gwin,
00571 int shape, int frame
00572 )
00573 {
00574 Shape_info& info = ShapeID::get_info(shape);
00575 int sclass = info.get_shape_class();
00576
00577 bool ireg = (sclass != Shape_info::unusable &&
00578 sclass != Shape_info::building);
00579 Game_object *newobj;
00580 if (ireg)
00581 newobj = gwin->get_map()->create_ireg_object(info,
00582 shape, frame, 0, 0, 0);
00583 else
00584 newobj = gwin->get_map()->create_ifix_object(shape, frame);
00585 return newobj;
00586 }
00587
00588
00589
00590
00591 void Cheat::paste
00592 (
00593 int mx, int my
00594 )
00595 {
00596 if (clipboard.empty())
00597 return;
00598
00599 Tile_coord hot = clipboard[0]->get_tile();
00600 clear_selected();
00601 #if 0
00602
00603 Gump *on_gump = gwin->get_gump_man()->find_gump(mx, my);
00604 #endif
00605 Game_object_vector::iterator it;
00606 for (it = clipboard.begin(); it != clipboard.end(); ++it)
00607 {
00608 Game_object *obj = *it;
00609 Tile_coord t = obj->get_tile();
00610
00611 int liftpix = ((t.tz - hot.tz)*c_tilesize)/2;
00612 int x = mx + (t.tx - hot.tx)*c_tilesize - liftpix,
00613 y = my + (t.ty - hot.ty)*c_tilesize - liftpix;
00614
00615 obj = Create_object(gwin, obj->get_shapenum(),
00616 obj->get_framenum());
00617 Dragging_info drag(obj);
00618 if (drag.drop(x, y, true))
00619 #if 0
00620 bool ok = false;
00621 if (on_gump)
00622 ok = on_gump->add(obj, mx, my, x, y)!=0;
00623 else
00624 for (int lift = edit_lift; !ok && lift <= 11; lift++)
00625 ok = gwin->drop_at_lift(obj, x, y, lift);
00626 if (ok)
00627 #endif
00628 append_selected(obj);
00629 #if 0
00630 else
00631 delete obj;
00632 #endif
00633 }
00634 gwin->set_all_dirty();
00635 }
00636
00637
00638
00639
00640
00641 void Cheat::paste()
00642 {
00643 if (clipboard.empty())
00644 return;
00645 int x, y;
00646 if (Get_click(x, y, Mouse::greenselect, 0, true))
00647 paste(x, y);
00648 }
00649
00650 const int border=2;
00651 const int worldsize = c_tiles_per_chunk * c_num_chunks;
00652
00653
00654
00655
00656 class Cheat_map : public Game_singletons, public Paintable
00657 {
00658 public:
00659 int x, y;
00660 int w, h;
00661 Shape_frame *map;
00662
00663 virtual void paint()
00664 {
00665 #if 0
00666 ShapeID mapid(game->get_shape("sprites/map"), 0, SF_SPRITES_VGA);
00667 #else
00668 ShapeID mapid(game->get_shape("sprites/cheatmap"), 1, SF_GAME_FLX);
00669 #endif
00670 map = mapid.get_shape();
00671
00672
00673 w = map->get_width();
00674 h = map->get_height();
00675 x = (gwin->get_width() - w)/2 + map->get_xleft();
00676 y = (gwin->get_height() - h)/2 + map->get_yabove();
00677 mapid.paint_shape(x, y, 1);
00678
00679
00680 int xx, yy;
00681 Tile_coord t = gwin->get_main_actor()->get_tile();
00682
00683
00684 xx = ((t.tx * (w - border*2)) / worldsize);
00685 yy = ((t.ty * (h - border*2)) / worldsize);
00686
00687 xx += x - map->get_xleft() + border;
00688 yy += y - map->get_yabove() + border;
00689 gwin->get_win()->fill8(255, 1, 5, xx, yy - 2);
00690 gwin->get_win()->fill8(255, 5, 1, xx - 2, yy);
00691 }
00692 };
00693
00694 void Cheat::map_teleport (void) const {
00695 if (!enabled) return;
00696 Cheat_map map;
00697 int xx, yy;
00698 if (!Get_click(xx, yy, Mouse::greenselect, 0, false, &map)) {
00699 gwin->paint();
00700 return;
00701 }
00702
00703 xx -= map.x - map.map->get_xleft() + border;
00704 yy -= map.y - map.map->get_yabove() + border;
00705 Tile_coord t;
00706 t.tx = static_cast<int>(((xx + 0.5)*worldsize) / (map.w - 2*border));
00707 t.ty = static_cast<int>(((yy + 0.5)*worldsize) / (map.h - 2*border));
00708
00709
00710 t.tx = (t.tx + c_num_tiles)%c_num_tiles;
00711 t.ty = (t.ty + c_num_tiles)%c_num_tiles;
00712 cout << "Teleporting to " << t.tx << "," << t.ty << "!" << endl;
00713 t.tz = 0;
00714 gwin->teleport_party(t);
00715 eman->center_text("Teleport!!!");
00716 }
00717
00718 void Cheat::cursor_teleport (void) const {
00719 if (!enabled) return;
00720
00721 int x, y;
00722 SDL_GetMouseState(&x, &y);
00723 x /= gwin->get_fastmouse() ? 1 : gwin->get_win()->get_scale();
00724 y /= gwin->get_fastmouse() ? 1 : gwin->get_win()->get_scale();
00725 Tile_coord t(gwin->get_scrolltx() + x/c_tilesize,
00726 gwin->get_scrollty() + y/c_tilesize, 0);
00727 gwin->teleport_party(t);
00728 eman->center_text("Teleport!!!");
00729 }
00730
00731 void Cheat::create_coins (void) const {
00732 if (!enabled) return;
00733
00734 gwin->get_main_actor()->add_quantity(100, 644);
00735 eman->center_text("Added 100 gold coins");
00736 }
00737
00738 void Cheat::create_last_shape (void) const {
00739 if (!enabled) return;
00740
00741 int current_shape = 0;
00742 int current_frame = 0;
00743 if(browser->get_shape(current_shape, current_frame)) {
00744 gwin->get_main_actor()->add(
00745 gwin->get_map()->create_ireg_object(
00746 current_shape, current_frame), 1);
00747 eman->center_text("Object created");
00748 } else
00749 eman->center_text("Can only create from 'shapes.vga'");
00750 }
00751
00752 void Cheat::delete_object (void) {
00753 if (!enabled) return;
00754
00755 int x, y;
00756 SDL_GetMouseState(&x, &y);
00757 x /= gwin->get_fastmouse() ? 1 : gwin->get_win()->get_scale();
00758 y /= gwin->get_fastmouse() ? 1 : gwin->get_win()->get_scale();
00759
00760 Game_object *obj;
00761 Gump *gump = gwin->get_gump_man()->find_gump(x, y);
00762 if (gump) {
00763 obj = gump->find_object(x, y);
00764 } else {
00765 obj = gwin->find_object(x, y);
00766 }
00767
00768 if (obj) {
00769 clear_selected();
00770 obj->remove_this();
00771 eman->center_text("Object deleted");
00772 gwin->paint();
00773 }
00774 }
00775
00776 void Cheat::heal_party (void) const {
00777 if (!enabled) return;
00778
00779 int i;
00780 Party_manager *partyman = gwin->get_party_man();
00781
00782
00783 int count = partyman->get_dead_count();
00784 int dead[16];
00785 if (count > 16)
00786 count = 16;
00787 for (i = 0; i < count; i++)
00788 dead[i] = partyman->get_dead_member(i);
00789 for (i = 0; i < count; i++) {
00790 int npc_num = dead[i];
00791 Dead_body *body = gwin->get_body(npc_num);
00792 Actor *live_npc = gwin->get_npc(npc_num);
00793 if (body && live_npc) {
00794 Tile_coord avpos = gwin->get_main_actor()->get_tile();
00795 body->move(avpos);
00796 live_npc->resurrect(body);
00797 }
00798 }
00799
00800
00801 Actor* party[9];
00802 count = gwin->get_party(party, 1);
00803 for (i = 0; i < count; i++) {
00804 if (!party[i]->is_dead()) {
00805
00806 party[i]->set_property(Actor::health, party[i]->get_property(Actor::strength));
00807
00808 party[i]->clear_flag(Obj_flags::poisoned);
00809
00810
00811 party[i]->set_property(Actor::food_level, 30);
00812 }
00813 }
00814
00815
00816 Main_actor* avatar = gwin->get_main_actor();
00817 avatar->set_property(Actor::mana, avatar->get_property(Actor::magic));
00818
00819 eman->center_text("Party healed");
00820 gwin->paint();
00821 }
00822
00823 void Cheat::shape_browser (void) const {
00824 if (!enabled) return;
00825
00826 browser->browse_shapes();
00827 gwin->paint();
00828 gwin->get_pal()->set(-1,-1);
00829 }
00830
00831 bool Cheat::get_browser_shape (int &shape, int &frame) const {
00832 if (!enabled) return false;
00833
00834 return browser->get_shape(shape, frame);
00835 }
00836
00837 void Cheat::sound_tester (void) const {
00838 if (!enabled) return;
00839
00840 tester->test_sound();
00841 gwin->paint();
00842 }
00843
00844
00845 void Cheat::cheat_screen (void) const {
00846 if (!enabled) return;
00847
00848 cscreen->show_screen();
00849 gwin->set_all_dirty();
00850 gwin->paint();
00851 }
00852
00853 void Cheat::toggle_grab_actor (void) {
00854 if (!enabled) return;
00855
00856 grab_actor = !grab_actor;
00857 if (grab_actor)
00858 eman->center_text("NPC Tool Actor Grabbing Enabled");
00859 else
00860 eman->center_text("NPC Tool Actor Grabbing Disabled");
00861 }
00862
00863 void Cheat::set_grabbed_actor (Actor *actor) const {
00864 if (!enabled||!cscreen) return;
00865
00866 cscreen->SetGrabbedActor(actor);
00867 }
00868
00869 void Cheat::clear_this_grabbed_actor(Actor *actor) const {
00870 if (!enabled||!cscreen) return;
00871
00872 cscreen->ClearThisGrabbedActor(actor);
00873 }
00874
00875 void Cheat::toggle_number_npcs (void) {
00876 if (!enabled) return;
00877
00878 npc_numbers = !npc_numbers;
00879 if (npc_numbers)
00880 eman->center_text("NPC Numbers Enabled");
00881 else
00882 eman->center_text("NPC Numbers Disabled");
00883 }