OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
scripttimer.h
1/*
2===========================================================================
3Copyright (C) 2024 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23// ScriptTimer.cpp: Scripted Timer & Fader
24//
25
26#pragma once
27
28#include "listener.h"
29
30typedef enum timertype_s {
31 TIMER_NORMAL,
32 TIMER_GLIDE
33} timertype_e;
34
35class ScriptTimer : public Listener
36{
37private:
38 float targetTime;
39 float currentTime;
40 float realTime;
41
42 float glideRatio;
43
44 timertype_e timerType;
45
46 bool bEnabled;
47
48private:
49 void GlideRefresh();
50
51public:
52 CLASS_PROTOTYPE( ScriptTimer );
53
54 ScriptTimer( timertype_e type = TIMER_NORMAL );
55 ~ScriptTimer();
56
57#if defined(ARCHIVE_SUPPORTED)
58 void Archive( Archiver &arc ) override;
59#endif
60
61 void Think( Event *ev );
62
63 void Disable();
64 void Enable();
65
66 qboolean Done();
67
68 float GetCurrentTime();
69 float GetRatio();
70 float GetTime();
71
72 float LerpValue( float start, float end );
73 Vector LerpValue( Vector start, Vector end );
74
75 void Reset();
76 void SetCurrentTime( float time );
77 void SetPhase( float phase );
78 void SetTime( float time );
79
80 bool isEnabled();
81 void setType( timertype_e type );
82};
Definition archive.h:86
Definition listener.h:246
Definition vector.h:61