File: DlgRocky.c

package info (click to toggle)
openclonk 8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 169,516 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (86 lines) | stat: -rw-r--r-- 2,246 bytes parent folder | download | duplicates (5)
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
#appendto Dialogue

/* Rocky dialogue */

func Dlg_Rocky_1(object clonk)
{
	if (clonk->FindContents(Axe))
	{
		MessageBox("$Rocky3$", clonk, clonk); // he's dnd
		StopDialogue();
		SetDialogueProgress(1);
	}
	else
	{
		MessageBox("$Rocky1$", clonk, clonk); // u got axe?
	}
	return true;
}

func Dlg_Rocky_2(object clonk)
{
	MessageBox("$Rocky2$", clonk, dlg_target); // check lorry
	StopDialogue();
	SetDialogueProgress(1);
	return true;
}


// post attack dialogue
func Dlg_Rocky_100(object clonk)
{
	MessageBox("$Rocky100$", clonk, clonk); // u can stop
	return true;
}

func Dlg_Rocky_101(object clonk)
{
	MessageBox("$Rocky101$", clonk, dlg_target); // stfu. must work.
	StopDialogue();
	SetDialogueProgress(101);
	return true;
}

// Generic call on every dlg message of Rocky
func Dlg_Rocky(object clonk)
{
	// Only if Clonk is actually talking
	if (clonk->FindContents(Axe)) return false;
	// Yield animation
	if (this.anim) dlg_target->StopAnimation(this.anim);
	this.anim = 0;
	this.anim_continue_frame = FrameCounter() + 50;
	return false; // do call specific functions
}


/* NPC animations */

static const Rocky_Pickaxe_SwingTime = 60;

func Dlg_Rocky_Init(object clonk)
{
	// Big pickaxe!
	var pickaxe = clonk->FindContents(Pickaxe);
	if (!pickaxe) pickaxe = clonk->CreateContents(Pickaxe);
	pickaxe.GetCarryTransform = Dialogue.Inventory_GetCarryTransform; // defined in Newton's dialogue
	var h_scale = 2000;
	pickaxe.ExtraTransform = Trans_Scale(h_scale,h_scale,h_scale);
	clonk.pickaxe_particle = new Particles_Glimmer() { Size = PV_Linear(5, 0) };
	// Pickaxeing animation
	AddEffect("RockyPickaxeing", clonk, 1, Rocky_Pickaxe_SwingTime, this);
	return true;
}

func FxRockyPickaxeingTimer(object c, proplist fx, int time)
{
	if (FrameCounter() < this.anim_continue_frame) { fx.phase=false; return FX_OK; }
	c->SetDir(DIR_Right);
	var len = c->GetAnimationLength("StrikePickaxe");
	this.anim = c->PlayAnimation("StrikePickaxe", CLONK_ANIM_SLOT_Arms, Anim_Linear(0,0,len, Rocky_Pickaxe_SwingTime, ANIM_Remove));
	c->Sound("Objects::Pickaxe::Clang?");
	var x = (c->GetDir()*2-1) * 9;
	var y = 9;
	c->CreateParticle("StarSpark", x,y, PV_Random(-20, 20), PV_Random(-20, 20), 20, c.pickaxe_particle, Random(10)+3);
	return FX_OK;
}