29 #include "../../idlib/precompiled.h"
32 #include "../../game/game.h"
33 #include "../../sys/win32/win_local.h"
34 #include "../../sys/win32/rc/common_resource.h"
35 #include "../../sys/win32/rc/SoundEditor_resource.h"
36 #include "../comafx/DialogName.h"
37 #include "../../sys/win32/rc/DeclEditor_resource.h"
38 #include "../decl/DialogDeclEditor.h"
43 #ifdef ID_DEBUG_MEMORY
49 extern HTREEITEM
FindTreeItem(CTreeCtrl *tree, HTREEITEM root,
const char *text, HTREEITEM forceParent);
86 CDialog::DoDataExchange(pDX);
123 ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_SOUNDS, OnSelchangedTreeSounds)
153 common->
Printf(
"Cannot run the sound editor in fullscreen mode.\n"
154 "Set r_fullscreen to 0 and vid_restart.\n" );
158 if ( g_SoundDialog ==
NULL ) {
163 if ( g_SoundDialog->GetSafeHwnd() ==
NULL ) {
174 g_SoundDialog->ShowWindow( SW_SHOW );
175 g_SoundDialog->SetFocus();
178 const char *
name = spawnArgs->GetString(
"name" );
180 g_SoundDialog->
Set( dict );
186 MSG *msg = AfxGetCurrentMessage();
188 MSG *msg = &m_msgCur;
191 while( ::PeekMessage(msg,
NULL,
NULL,
NULL, PM_NOREMOVE) ) {
193 if ( !AfxGetApp()->PumpMessage() ) {
200 g_SoundDialog =
NULL;
204 CDialog::OnActivate( nState, pWndOther, bMinimized );
205 if ( nState != WA_INACTIVE ) {
210 if ( GetSafeHwnd() ) {
212 GetWindowRect( rct );
215 CDialog::OnMove( x, y );
222 return CDialog::OnDestroy();
227 if ( source ==
NULL ) {
258 if ( source ==
NULL ) {
262 float f = source->
GetFloat(
"s_volume" );
307 if ( dict ==
NULL ) {
342 if ( dict ==
NULL ) {
360 src.
SetBool(
"s_justVolume",
true );
371 if ( updateInUseTree ) {
396 HTREEITEM item = base;
412 index = name.
Last(
'/');
414 name.
Left(index, last);
434 index = name.
Find(
'/');
436 HTREEITEM newItem =
NULL;
437 HTREEITEM *check =
NULL;
438 name.
Left( index, out );
445 if (newItem ==
NULL) {
473 HTREEITEM base =
treeSounds.InsertItem(
"Sound Shaders");
481 for ( i = 0; i < list.
Num(); i++ ) {
482 HTREEITEM child =
treeSounds.InsertItem(list[i], base);
493 for (j = 0; j < list2.
Num(); j++) {
494 HTREEITEM child2 =
treeSounds.InsertItem( list2[j], child );
529 for ( i = 0; i <
count; i++ ) {
532 const char *
p = dict->
GetString(
"s_shader" );
540 for ( i = 0; i <
count; i++ ) {
568 CDialog::OnInitDialog();
621 }
else if ( dw ==
WAVES ) {
633 wnd->SetWindowText( ( p && *p ) ? p :
"unknown" );
639 NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
640 HTREEITEM item =
treeSounds.GetSelectedItem();
649 }
else if (dw ==
WAVES) {
676 declEditor->
LoadDecl( const_cast<idDecl *>( decl ) );
677 declEditor->ShowWindow( SW_SHOW );
678 declEditor->SetFocus();
696 args.
Set(
"classname",
"speaker");
697 args.
Set(
"angle",
va(
"%f", viewAngles.
yaw + 180 ));
699 args.
Set(
"s_looping",
"1" );
700 args.
Set(
"s_shakes",
"0" );
704 bool nameValid =
false;
708 if (dlg.DoModal() == IDOK) {
711 if (MessageBox(
"Please choose another name",
"Duplicate Entity Name!", MB_OKCANCEL) == IDCANCEL) {
746 bool removed =
false;
750 if ( dict ==
NULL ) {
756 if (MessageBox(
"Are you Sure?",
"Delete Selected Speakers", MB_YESNO) == IDYES) {
778 CFileDialog dlgSave(
FALSE,
"map",
NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Map Files (*.map)|*.map||",AfxGetMainWnd());
779 if (dlgSave.DoModal() == IDOK) {
790 HTREEITEM parent =
treeSounds.GetParentItem(item);
792 while (
true && parent) {
802 if (parent ==
NULL) {
822 if ( dict ==
NULL ) {
936 HTREEITEM item =
treeSounds.GetSelectedItem();
942 HTREEITEM child =
treeSounds.GetChildItem(item);
944 HTREEITEM next =
treeSounds.GetNextSiblingItem(child);
951 for (
int i = 0;
i <
c;
i++) {
965 if ( wnd && pMsg->hwnd == wnd->GetSafeHwnd() ) {
966 if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) {
968 wnd->GetWindowText( str );
973 return CDialog::PreTranslateMessage(pMsg);
virtual void EntityUpdateChangeableSpawnArgs(idEntity *ent, const idDict *dict)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
#define IDC_BTN_EDIT_SOUND
float GetFloat(const char *key, const char *defaultString="0") const
GLsizei const GLfloat * value
int GetInt(const char *key, const char *defaultString="0") const
void Set(const idDict *source)
HTREEITEM AddStrList(const char *root, const idStrList &list, int id)
virtual void DoDataExchange(CDataExchange *pDX)
virtual void MapAddEntity(const idDict *dict) const
assert(prefInfo.fullscreenBtn)
#define IDC_BTN_REFRESHSPEAKERS
const char * GetFileName(void) const
afx_msg void OnSelchangedTreeSounds(NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
virtual void MapRemoveEntity(const char *name) const
#define IDC_CHECK_OCCLUSION
CONST PIXELFORMATDESCRIPTOR UINT
virtual void EntityTranslate(idEntity *ent, const idVec3 &org)
#define IDC_CHECK_UNCLAMPED
void SetNum(int newnum, bool resize=true)
afx_msg void OnBtnSwitchtogame()
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
void UpdateSelectedOrigin(float x, float y, float z)
int GetNumFiles(void) const
const idStrList & GetList(void) const
#define IDC_BTN_APPLY_SOUND
virtual void PlayShaderDirectly(const char *name, int channel=-1)=0
#define IDC_BTN_SWITCHTOGAME
virtual BOOL OnInitDialog()
virtual const char * GetUniqueEntityName(const char *classname) const
idRenderSystem * renderSystem
idFileSystem * fileSystem
virtual void EntityStopSound(idEntity *ent)
virtual void TriggerSelected()
afx_msg void OnCheckPlay()
const char * GetName(void) const
afx_msg void OnBtnRefreshwave()
const char * Left(int len, idStr &result) const
afx_msg void OnBtnSavemap()
idStr RebuildItemName(const char *root, HTREEITEM item)
#define IDC_EDIT_SOUND_NAME
void Set(const char *key, const char *value)
#define IDC_BTN_REFRESHWAVE
CDialogSound * g_SoundDialog
afx_msg void OnCheckGrouponly()
afx_msg void OnBtnSavemapas()
void SetFloat(const char *key, float val)
void SoundEditorInit(const idDict *spawnArgs)
int Icmp(const char *text) const
idStr & BackSlashesToSlashes(void)
int Icmpn(const char *text, int n) const
virtual idSoundWorld * GetPlayingSoundWorld(void)=0
GLsizei GLsizei GLcharARB * source
virtual void MapCopyDictToEntity(const char *name, const idDict *dict) const
virtual void MapSetEntityKeyVal(const char *name, const char *key, const char *val) const
void Set(const char *key, Type &value)
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
virtual void PlayerGetEyePosition(idVec3 &org) const
afx_msg void OnBtnRefresh()
#define IDC_CHECKP_TRIGGERED
GLuint GLuint GLsizei count
void SoundEditorRun(void)
virtual bool IsFullScreen(void) const =0
const char * GetString(const char *key, const char *defaultString="") const
idVec3 ToForward(void) const
idHashTable< HTREEITEM > quickTree
#define IDC_COMBO_SPEAKERS
virtual void MapSave(const char *path=NULL) const
afx_msg void OnSelchangeComboGroups()
virtual void PlayerGetViewAngles(idAngles &angles) const
bool GetBool(const char *key, const char *defaultString="0") const
virtual void EntityDelete(idEntity *ent)
virtual void AddSelectedEntity(idEntity *ent)
afx_msg void OnBtnPlaysound()
#define IDC_CHECK_LOOPING
const char * GetFile(int index) const
virtual void Reload(bool force)=0
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
void ApplyChanges(bool volumeOnly=false, bool updateInUseTree=true)
virtual void FreeFileList(idFileList *fileList)=0
void SetBool(const char *key, bool val)
afx_msg void OnBtnRefreshspeakers()
virtual const idSoundShader * SoundByIndex(int index, bool forceParse=true)=0
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void LoadDecl(idDecl *decl)
const char * ToString(int precision=2) const
virtual int GetSelectedEntities(idEntity *list[], int max)
afx_msg void OnBtnApply()
CDialogSound(CWnd *pParent=NULL)
idDeclManager * declManager
#define IDC_BTN_PLAYSOUND
virtual int GetNumDecls(declType_t type)=0
bool Get(const char *key, Type **value=NULL) const
afx_msg void OnBtnTrigger()
int Append(const type &obj)
void SetInt(const char *key, int val)
void SetWaveSize(const char *p=NULL)
virtual const idDecl * FindDeclWithoutParsing(declType_t type, const char *name, bool makeDefault=true)=0
int AddUnique(const type &obj)
virtual idFileList * ListFilesTree(const char *relativePath, const char *extension, bool sort=false, const char *gamedir=NULL)=0
void SoundEditorShutdown(void)
MFnDagNode * GetParent(MFnDagNode *joint)
int Last(const char c) const
#define IDC_STATIC_WAVESIZE
idSoundSystem * soundSystem
virtual int MapGetEntitiesMatchingClassWithString(const char *classname, const char *match, const char *list[], const int max) const
void AddSounds(bool rootItem)
afx_msg void OnDblclkTreeSounds(NMHDR *pNMHDR, LRESULT *pResult)
const char * c_str(void) const
afx_msg void OnBtnGroup()
virtual const idDict * MapGetEntityDict(const char *name) const
virtual void ClearEntitySelection(void)
HTREEITEM FindTreeItem(CTreeCtrl *tree, HTREEITEM root, const char *text, HTREEITEM forceParent)
virtual void SpawnEntityDef(const idDict &args, idEntity **ent)
virtual const idDict * EntityGetSpawnArgs(idEntity *ent) const
afx_msg void OnMove(int x, int y)
afx_msg void OnChangeEditVolume()
char * va(const char *fmt,...)
virtual const char * OSPathToRelativePath(const char *OSPath)=0
virtual BOOL PreTranslateMessage(MSG *pMsg)
virtual idEntity * FindEntity(const char *name) const
#define IDD_DIALOG_DECLEDITOR
virtual void MapEntityTranslate(const char *name, const idVec3 &v) const
afx_msg void OnSelchangeComboSpeakers()
virtual int MapGetUniqueMatchingKeyVals(const char *key, const char *list[], const int max) const
virtual void EntityUpdateVisuals(idEntity *ent)
#define IDC_EDIT_LEADTHROUGH
#define IDC_BTN_SAVEMAPAS
#define IDC_CHECK_GROUPONLY