File: loop_brief.cpp

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (81 lines) | stat: -rw-r--r-- 1,605 bytes parent folder | download
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
#include "loop_brief.h"

namespace scripting {
namespace api {

cmission_h::cmission_h() : l_stage(-1) {}

cmission_h::cmission_h(int stage) : l_stage(stage) {}

bool cmission_h::isValid() const
{
	return l_stage >= 0;
}

cmission* cmission_h::getStage() const
{
	return &Campaign.missions[l_stage];
}

//**********HANDLE: loop_briefing
ADE_OBJ(l_LoopBriefStage, cmission_h, "loop_brief_stage", "Loop Brief stage handle");

ADE_VIRTVAR(Text,
	l_LoopBriefStage,
	nullptr,
	"The text of the stage",
	"string",
	"The text")
{
	cmission_h current;
	if (!ade_get_args(L, "o", l_LoopBriefStage.Get(&current))) {
		return ADE_RETURN_NIL;
	}

	if (ADE_SETTING_VAR) {
		LuaError(L, "This property is read only.");
	}

	return ade_set_args(L, "s", current.getStage()->mission_branch_desc);
}

ADE_VIRTVAR(AniFilename,
	l_LoopBriefStage,
	nullptr,
	"The ani filename of the stage",
	"string",
	"The ani filename")
{
	cmission_h current;
	if (!ade_get_args(L, "o", l_LoopBriefStage.Get(&current))) {
		return ADE_RETURN_NIL;
	}

	if (ADE_SETTING_VAR) {
		LuaError(L, "This property is read only.");
	}

	return ade_set_args(L, "s", current.getStage()->mission_branch_brief_anim);
}

ADE_VIRTVAR(AudioFilename,
	l_LoopBriefStage,
	nullptr,
	"The audio file of the stage",
	"string",
	"The audio filename")
{
	cmission_h current;
	if (!ade_get_args(L, "o", l_LoopBriefStage.Get(&current))) {
		return ADE_RETURN_NIL;
	}

	if (ADE_SETTING_VAR) {
		LuaError(L, "This property is read only.");
	}

	return ade_set_args(L, "s", current.getStage()->mission_branch_brief_sound);
}

} // namespace api
} // namespace scripting