File: keyactions.cc

package info (click to toggle)
exult 1.2-15
  • links: PTS, VCS
  • area: contrib
  • in suites: squeeze
  • size: 8,640 kB
  • ctags: 10,524
  • sloc: cpp: 99,373; sh: 7,324; ansic: 4,659; makefile: 985; yacc: 769; lex: 313; xml: 19
file content (785 lines) | stat: -rw-r--r-- 20,486 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
/*
 *  Copyright (C) 2001-2004 The Exult Team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include "keyactions.h"
#include "keys.h"
#include "gump_utils.h"
#include "gamewin.h"
#include "mouse.h"
#include "actors.h"
#include "game.h"
#include "exult.h"
#include "exult_types.h"
#include "exult_constants.h"
#include "File_gump.h"
#include "Scroll_gump.h"
#include "cheat.h"
#include "combat_opts.h"
#include "ucmachine.h"
#include "party.h"
#include "Audio.h"
#include "Gamemenu_gump.h"
#include "Newfile_gump.h"
#include "Face_stats.h"
#include "Gump_manager.h"
#include "effects.h"
#include "palette.h"

/*
 *	Get the i'th party member, with the 0'th being the Avatar.
 */

static Actor *Get_party_member
(
 int num				// 0=avatar.
)
{
	int npc_num = 0;	 	// Default to Avatar
	if (num > 0)
		npc_num = Game_window::get_instance()->get_party_man()->get_member(num - 1);
	return Game_window::get_instance()->get_npc(npc_num);
}


//  { ActionQuit, 0, "Quit", true, false, NONE },
void ActionQuit(int *params)
{
	Game_window::get_instance()->get_gump_man()->okay_to_quit();
}

// { ActionOldFileGump, 0, "Save/restore", true, false, NONE },
void ActionOldFileGump(int *params)
{
	File_gump *fileio = new File_gump();
	Game_window::get_instance()->get_gump_man()->do_modal_gump(fileio, 
															   Mouse::hand);
	delete fileio;
}

// { ActionMenuGump, 0, "GameMenu", true, false, NONE },
void ActionMenuGump(int *params)
{
	Gamemenu_gump *gmenu = new Gamemenu_gump();
	Game_window::get_instance()->get_gump_man()->do_modal_gump(gmenu,
															   Mouse::hand);
	delete gmenu;
}

// { ActionFileGump, 0, "Save/restore", true, false, NONE },
void ActionFileGump(int *params)
{
	Newfile_gump *fileio = new Newfile_gump();
	Game_window::get_instance()->get_gump_man()->do_modal_gump(fileio,
															   Mouse::hand);
	delete fileio;
}
//  { ActionQuicksave, 0, "Quick-save", true, false, NONE },
void ActionQuicksave(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	try {
		gwin->write();
	}
	catch(exult_exception &e) {
		gwin->get_effects()->center_text("Saving game failed!");
		return;
	}
	gwin->get_effects()->center_text("Game saved");
}

//  { ActionQuickrestore, 0, "Quick-restore", true, false, NONE },
void ActionQuickrestore(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	try {
		gwin->read();
	}
	catch(exult_exception &e) {
		gwin->get_effects()->center_text("Restoring game failed!");
		return;
	}
	gwin->get_effects()->center_text("Game restored");
	gwin->paint();
}

//  { ActionAbout, 0, "About Exult", true, false, NONE },
void ActionAbout(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	Scroll_gump *scroll;
	scroll = new Scroll_gump();
	
	scroll->add_text("Exult V"VERSION"\n");
	scroll->add_text("(C) 1998-2004 Exult Team\n\n");
	scroll->add_text("Available under the terms of the ");
	scroll->add_text("GNU General Public License\n\n");
	scroll->add_text("http://exult.sourceforge.net\n");
	
	scroll->paint();
	do {
		int x, y;
		Get_click(x,y, Mouse::hand);
	} while (scroll->show_next_page());
	gwin->paint();
	delete scroll;
}

//  { ActionHelp, 0, "List keys", true, false, NONE },
void ActionHelp(int *params)
{
	keybinder->ShowHelp();
}

//  { ActionCloseGumps, 0, "Close gumps", false, false, NONE },
void ActionCloseGumps(int *params)
{
	Game_window::get_instance()->get_gump_man()->close_all_gumps();
}

//  { ActionCloseOrMenu, "Game menu", true, false, NONE },
void ActionCloseOrMenu(int* params)
{
	Game_window *gwin = Game_window::get_instance();
	if (gwin->get_gump_man()->showing_gumps(true))
		gwin->get_gump_man()->close_all_gumps();
	else
		ActionMenuGump(0);
}

//  { ActionScreenshot, 0, "Take screenshot", true, false, NONE },
void ActionScreenshot(int *params)
{
	make_screenshot();
}

//  { ActionRepaint, 0, "Repaint screen", false, false, NONE },
void ActionRepaint(int *params)
{
	Game_window::get_instance()->paint();
}

//  { ActionResIncrease, 0, "Increase resolution", true, true, NONE },
void ActionResIncrease(int *params)
{
	increase_resolution();
}

//  { ActionResDecrease, 0, "Decrease resolution", true, true, NONE },
void ActionResDecrease(int *params)
{
	decrease_resolution();
}

//  { ActionBrighter, 0, "Increase brightness", true, false, NONE },
void ActionBrighter(int *params)
{
	change_gamma(true);
}

//  { ActionDarker, 0, "Decrease brightness", true, false, NONE },
void ActionDarker(int *params)
{
	change_gamma(false);
}

//  { ActionFullscreen, 0, "Toggle fullscreen", true, false, NONE },
void ActionFullscreen(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	gwin->get_win()->toggle_fullscreen();
	gwin->paint();
}

//  { ActionUseItem, 3, "Use item", false, false, NONE },
// params[0] = shape nr.
// params[1] = frame nr.
// params[2] = quality
void ActionUseItem(int *params)
{
	if (params[1] == -1) params[1] = c_any_framenum;
	if (params[2] == -1) params[2] = c_any_qual;
	Game_window::get_instance()->activate_item(params[0], params[1], params[2]);

	Mouse::mouse->set_speed_cursor();
}

//  { ActionUseItem, 3, "Use food", false, false, NONE },
void ActionUseFood(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	if (!gwin->activate_item(377) &&	// First try normal food items.
	    GAME_SI)			// SI has 'everlasting goblet'.
		gwin->activate_item(0x268, 20);
	Mouse::mouse->set_speed_cursor();
}

//  { ActionCombat, 0, "Toggle combat", true, false, NONE },
void ActionCombat(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	gwin->toggle_combat();
	gwin->paint();
	Mouse::mouse->set_speed_cursor();
}

//  { ActionCombatPause, 0, "Pause combat", true, false, NONE },
void ActionCombatPause(int *params)
{
	Combat::toggle_pause();
	Mouse::mouse->set_speed_cursor();
}

//  { ActionTarget, 0, "Target mode", true, false, NONE },
void ActionTarget(int *params)
{
	int x, y;
	if (!Get_click(x, y, Mouse::greenselect))
		return;
	Game_window::get_instance()->double_clicked(x, y);
	Mouse::mouse->set_speed_cursor();
}

//  { ActionInventory, 1, "Show inventory", true, false, NONE },
// params[0] = party member (0-7), or -1 for 'next'
void ActionInventory(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	static int inventory_page = -1;
	Actor *actor;
	
	if (params[0] == -1) {
		Gump_manager *gump_man = gwin->get_gump_man();
		int party_count = gwin->get_party_man()->get_count();
		int shapenum;
		
		for(int i=0;i<=party_count;++i)
		{
			actor = Get_party_member(i);
			if (!actor)
				continue;

			shapenum = actor->inventory_shapenum();
			// Check if this actor's inventory page is open or not
			if (!gump_man->find_gump(actor, shapenum))
			{
				gump_man->add_gump(actor, shapenum); //force showing inv.
				inventory_page = i;
				return;
			}
		}
		inventory_page = (inventory_page+1)%(party_count+1);
	} else {
		inventory_page = params[0];
		if (inventory_page < 0 ||
				inventory_page > gwin->get_party_man()->get_count())
			return;
	}
	
	actor = Get_party_member(inventory_page);
	if (actor) {
		actor->show_inventory(); //force showing inv.
	}

	Mouse::mouse->set_speed_cursor();
}

//  { ActionTryKeys, 0, "Try keys", true, false, NONE },
void ActionTryKeys(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int x, y;			// Allow dragging.
	if (!Get_click(x, y, Mouse::greenselect, 0, true))
		return;
	// Look for obj. in open gump.
	Gump *gump = gwin->get_gump_man()->find_gump(x, y);
	Game_object *obj;
	if (gump)
		obj = gump->find_object(x, y);
	else				// Search rest of world.
		obj = gwin->find_object(x, y);
	if (!obj)
		return;
	int qual = obj->get_quality();	// Key quality should match.
	Actor *party[10];		// Get ->party members.
	int party_cnt = gwin->get_party(&party[0], 1);
	for (int i = 0; i < party_cnt; i++) {
		Actor *act = party[i];
		Game_object_vector keys;		// Get keys.
		if (act->get_objects(keys, 641, qual, c_any_framenum)) {
			// intercept the click_on_item call made by the key-usecode
			gwin->get_usecode()->intercept_click_on_item(obj);
			keys[0]->activate();
			return;
		}
	}
	Mouse::mouse->flash_shape(Mouse::redx);	// Nothing matched.
}

//  { ActionStats, 1, "Show stats", true, false, NONE },
// params[0] = party member (0-7), or -1 for 'next'
void ActionStats(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	static int stats_page = -1;
	Actor *actor;
	
	if (params[0] == -1) {
		Gump_manager *gump_man = gwin->get_gump_man();
		int party_count = gwin->get_party_man()->get_count();
		int shapenum = game->get_shape("gumps/statsdisplay");

		for(int i=0;i<=party_count;++i)
		{
			actor = Get_party_member(i);
			if (!actor)
				continue;

			// Check if this actor's stats page is open or not
			if (!gump_man->find_gump(actor, shapenum))
			{
				gump_man->add_gump(actor, shapenum); //force showing stats.
				stats_page = i;
				return;
			}
		}
		stats_page = (stats_page+1)%(party_count+1);
	} else {
		stats_page = params[0];
		if (stats_page < 0 ||
			stats_page >= gwin->get_party_man()->get_count())
			stats_page = 0;
	}
	
	actor = Get_party_member(stats_page);
	if (actor) gwin->get_gump_man()->add_gump(actor, game->get_shape("gumps/statsdisplay"));

	Mouse::mouse->set_speed_cursor();
}

//  { ActionCombatStats, 0, "Show Combat stats", true, false, SERPENT_ISLE }
void ActionCombatStats(int* params)
{
	Game_window *gwin = Game_window::get_instance();
	int cnt = gwin->get_party_man()->get_count();
	gwin->get_gump_man()->add_gump(gwin->get_main_actor(), game->get_shape("gumps/cstats/1") + cnt);
}

//  { ActionFaceStats, 0, "Change Face Stats State", true, false, NONE }
void ActionFaceStats(int* params)
{
	Face_stats::AdvanceState();
	Face_stats::save_config(config);
}


//  { ActionSIIntro, 0,  "Show SI intro", true, true, SERPENT_ISLE },
void ActionSIIntro(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	game->set_jive();
	game->play_intro();
	game->clear_jive();
	gwin->clear_screen(true);
	gwin->get_pal()->set(0);
	gwin->paint();
	gwin->get_pal()->fade(50, 1, 0);
}

//  { ActionEndgame, 1, "Show endgame", true, true, BLACK_GATE },
// params[0] = -1,0 = won, 1 = lost
void ActionEndgame(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	game->end_game(params[0] != 1);
	gwin->clear_screen(true);
	gwin->get_pal()->set(0);
	gwin->paint();
	gwin->get_pal()->fade(50, 1, 0);
}

//  { ActionScrollLeft, 0, "Scroll left", true, true, NONE },
void ActionScrollLeft(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	for (int i = 16; i; i--)
		gwin->view_left();
}

//  { ActionScrollRight, 0, "Scroll right", true, true, NONE },
void ActionScrollRight(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	for (int i = 16; i; i--)
		gwin->view_right();
}

//  { ActionScrollUp, 0, "Scroll up", true, true, NONE },
void ActionScrollUp(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	for (int i = 16; i; i--)
		gwin->view_up();
}

//  { ActionScrollDown, 0, "Scroll down", true, true, NONE },
void ActionScrollDown(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	for (int i = 16; i; i--)
		gwin->view_down();
}

//  { ActionWalkWest, 0, "Walk west", true, false, NONE },
void ActionWalkWest(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2-50, gwin->get_height()/2,speed);
}

//  { ActionWalkEast, 0, "Walk east", true, false, NONE },
void ActionWalkEast(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2+50, gwin->get_height()/2, speed);
}

//  { ActionWalkNorth, 0, "Walk north", true, false, NONE },
void ActionWalkNorth(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2, gwin->get_height()/2-50, speed);
}

//  { ActionWalkSouth, 0, "Walk south", true, false, NONE },
void ActionWalkSouth(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2, gwin->get_height()/2+50, speed);
}

//  { ActionWalkNorthEast, 0, "Walk north-east", true, false, NONE },
void ActionWalkNorthEast(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2+50, gwin->get_height()/2-50, speed);
}

//  { ActionWalkSouthEast, 0, "Walk south-east", true, false, NONE },
void ActionWalkSouthEast(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2+50, gwin->get_height()/2+50, speed);
}

//  { ActionWalkNorthWest, 0, "Walk north-west", true, false, NONE },
void ActionWalkNorthWest(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2-50, gwin->get_height()/2-50, speed);
}

//  { ActionWalkSouthWest, 0, "Walk south-west", true, false, NONE },
void ActionWalkSouthWest(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	int speed = params[0]<0?166:50;
	gwin->start_actor(gwin->get_width()/2-50, gwin->get_height()/2+50, speed);
}

//  { ActionStopWalking, 0, "Stop Walking", true, true, NONE },
void ActionStopWalking(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	gwin->stop_actor();
}

//  { ActionCenter, 0, "Center screen", true, true, NONE },
void ActionCenter(int *params)
{
	Game_window *gwin = Game_window::get_instance();
	gwin->center_view(gwin->get_camera_actor()->get_tile());
	gwin->paint();
}

//  { ActionShapeBrowser, 0, "Shape browser", true, true, NONE },
void ActionShapeBrowser(int *params)
{
	cheat.shape_browser();
}

//  { ActionCreateShape, 3, "Create last shape", true, true, NONE },
// params[0] = shape nr., or -1 for 'last selected shape in browser'
// params[1] = frame nr.
// params[2] = quantity
// params[3] = quality
void ActionCreateShape(int *params)
{
	if (params[0] == -1) {
		cheat.create_last_shape();
	} else {
		Game_window *gwin = Game_window::get_instance();
		if (params[1] == -1) params[1] = 0;
		if (params[2] == -1) params[2] = 1;
		if (params[3] == -1) params[3] = c_any_qual;
		gwin->get_main_actor()->add_quantity(params[2], params[0], params[3], params[1]);
		gwin->get_effects()->center_text("Object created");
	}
}

//  { ActionDeleteObject, 0, "Delete object", true, true, NONE },
void ActionDeleteObject(int *params)
{
	cheat.delete_object();
}

//  { ActionDeleteSelected, "Delete selected", true, ture, NONE, false },
void ActionDeleteSelected(int *params)
{
	cheat.delete_selected();
}

//  { ActionMoveSelected, 3, "Move selected", true, true, NONE },
// params[0] = deltax (tiles)
// params[1] = deltay
// params[2] = deltaz
void ActionMoveSelected(int *params)
{
	cheat.move_selected(params[0], params[1], params[2]);
}

//  { ActionToggleEggs, 0, "Toggle egg display", true, true, NONE },
void ActionToggleEggs(int *params)
{
	cheat.toggle_eggs();
}

//  { ActionGodMode, 1, "Toggle god mode", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionGodMode(int *params)
{
	if (params[0] == -1)
		cheat.toggle_god();
	else
		cheat.set_god(params[0] != 0);
}

//  { ActionGender, 0, "Change gender", true, true, NONE },
void ActionGender(int *params)
{
	cheat.change_gender();
}

//  { ActionCheatHelp, 0, "List cheat keys", true, true, NONE },
void ActionCheatHelp(int *params)
{
	keybinder->ShowCheatHelp();
}

//  { ActionInfravision, 1, "Toggle infravision", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionInfravision(int *params)
{
	if (params[0] == -1)
		cheat.toggle_infravision();
	else
		cheat.set_infravision(params[0] != 0);
}

//  { ActionSkipLift, 1, "Change skiplift", true, true, NONE },
// params[0] = level, or -1 to decrease one
void ActionSkipLift(int *params)
{
	if (params[0] == -1)
		cheat.dec_skip_lift();
	else
		cheat.set_skip_lift(params[0]);
}

//  { ActionLevelup, 1, "Level-up party", true, true, NONE },
// params[0] = nr. of levels (or -1 for one)
void ActionLevelup(int *params)
{
	if (params[0] == -1) params[0] = 1;
	for (int i=0; i < params[0]; i++)
		cheat.levelup_party();
}

//  { ActionMapEditor, 1, "Toggle map-editor mode", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionMapEditor(int *params)
{
	if (params[0] == -1)
		cheat.toggle_map_editor();
	else
		cheat.set_map_editor(params[0] != 0);
}

// { ActionHackMover, "Toggle hack-mover mode", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionHackMover(int *params)
{
	if (params[0] == -1)
		cheat.toggle_hack_mover();
	else
		cheat.set_hack_mover(params[0] != 0);
}

//  { ActionMapTeleport, 0, "Map teleport", true, true, NONE },
void ActionMapTeleport(int *params)
{
	cheat.map_teleport();
}

//  { ActionTeleport, 0, "Teleport to cursor", true, true, NONE },
void ActionTeleport(int *params)
{
	cheat.cursor_teleport();
}

//  { ActionTime, 0, "Next time period", true, true, NONE },
void ActionTime(int *params)
{
	cheat.fake_time_period();
}

//  { ActionWizard, 1, "Toggle archwizard mode", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionWizard(int *params)
{
	if (params[0] == -1)
		cheat.toggle_wizard();
	else
		cheat.set_wizard(params[0] != 0);
}

//  { ActionHeal, 0, "Heal party", true, true, NONE },
void ActionHeal(int *params)
{
	cheat.heal_party();
}

//  { ActionCheatScreen, 0, "Cheat Screen", true, true, NONE },
void ActionCheatScreen(int *params)
{
	cheat.cheat_screen();
}

//  { ActionPickPocket, 1, "Toggle Pickpocket", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionPickPocket(int *params)
{
	if (params[0] == -1)
		cheat.toggle_pickpocket();
	else
		cheat.set_pickpocket(params[0] != 0);
}

//  { ActionPickPocket, 1, "Toggle Pickpocket", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionNPCNumbers(int *params)
{
	if (params[0] == -1)
		cheat.toggle_number_npcs();
	else
		cheat.set_number_npcs(params[0] != 0);
}

//  { ActionGrabActor, 1, "Grab Actor for Cheatscreen", true, true, NONE },
// params[0] = -1 for toggle, 0 for off, 1 for on
void ActionGrabActor(int *params)
{
	if (params[0] == -1)
		cheat.toggle_grab_actor();
	else
		cheat.set_grab_actor(params[0] != 0);
}

//  { ActionCut, "Cut Selected Objects", true, false, NONE, true},
void ActionCut(int *params)
{
	cheat.cut(false);
}

//  { ActionCopy, "Copy Selected Objects", true, false, NONE, true},
void ActionCopy(int *params)
{
	cheat.cut(true);
}

//  { ActionPaste, "Paste Selected Objects", true, false, NONE, true},
void ActionPaste(int *params)
{
	cheat.paste();
}

//  { ActionPlayMusic, 1, "Play song", false, true, NONE },
// params[0] = song nr., or -1 for next, -2 for previous
void ActionPlayMusic(int *params)
{
	static int mnum = 0;

	if (params[0] == -1) {
		Audio::get_ptr()->start_music(mnum++, 0);
	} else if (params[0] == -2) {
		if (mnum > 0)
			Audio::get_ptr()->start_music(--mnum, 0);
	} else {
		mnum = params[0];
		Audio::get_ptr()->start_music(mnum, 0);
	}
}

//  { ActionNaked, 0, "Toggle naked mode", true, true, SERPENT_ISLE },
void ActionNaked(int  *params)
{
	cheat.toggle_naked();
}

//  { ActionPetra, 0, "Toggle Petra mode", true, true, SERPENT_ISLE },
void ActionPetra(int *params)
{
	cheat.toggle_Petra();
}

//  { ActionSkinColour, 0 "Change skin colour", true, true, NONE },
void ActionSkinColour(int *params)
{
	cheat.change_skin();
}

//  { ActionSoundTester, 0, "Sound tester", false, true, NONE }
void ActionSoundTester(int *params)
{
	cheat.sound_tester();
}

void ActionTest(int *params)
{
}