~ares-developers/ares/gd03

« back to all changes in this revision

Viewing changes to src/UI/Illuminati.cxx

  • Committer: Renegade
  • Date: 2010-05-29 08:12:17 UTC
  • Revision ID: git-v1:0a1bb6321f04d723afe64d1b843dc87b4da783ec
Creating /trunk/src.

git-svn-id: svn://svn.renegadeprojects.com/ares/trunk@622 859b54a9-7a54-0410-aeb3-f8d2f1fa40fd

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <windows.h>
 
2
#include <CommCtrl.h>
 
3
 
 
4
#include <MouseClass.h>
 
5
#include <ScenarioClass.h>
 
6
#include <Unsorted.h>
 
7
 
 
8
#include "../Misc/Debug.h"
 
9
#include "Dialogs.h"
 
10
#include "registered.h"
 
11
 
 
12
BOOL CALLBACK Dialogs::Illuminati::WndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) {
 
13
        BOOL result = UI::StandardWndProc(hwndDlg, message, wParam, lParam);
 
14
        if(!result) {
 
15
                switch(message) {
 
16
                case WM_INITDIALOG:
 
17
                        Init(hwndDlg);
 
18
                        break;
 
19
                case WM_COMMAND:
 
20
                        switch(LOWORD(wParam)) {
 
21
                                case IDCANCEL:
 
22
                                case ARES_BTN_YES:
 
23
                                        Apply(hwndDlg, 1);
 
24
                                        break;
 
25
                                case ARES_BTN_NO:
 
26
                                        Apply(hwndDlg, 0);
 
27
                                        break;
 
28
                        }
 
29
                        break;
 
30
                case WM_CLOSE:
 
31
                        Apply(hwndDlg, 1);
 
32
                        break;
 
33
                }
 
34
        }
 
35
        return result;
 
36
}
 
37
 
 
38
void Dialogs::Illuminati::Init(HWND hwndDlg) {
 
39
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_R)) {
 
40
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 100 * 0x10000);
 
41
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->Red);
 
42
        }
 
43
 
 
44
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_G)) {
 
45
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 100 * 0x10000);
 
46
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->Green);
 
47
        }
 
48
 
 
49
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_B)) {
 
50
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 100 * 0x10000);
 
51
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->Blue);
 
52
        }
 
53
 
 
54
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_AMBIENT)) {
 
55
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 100 * 0x10000);
 
56
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->AmbientCurrent);
 
57
        }
 
58
 
 
59
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_GROUND)) {
 
60
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 1000 * 0x10000);
 
61
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->Ground);
 
62
        }
 
63
 
 
64
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_LEVEL)) {
 
65
                Imports::SendMessageA(Slider, TBM_SETRANGE, 1, 1000 * 0x10000);
 
66
                Imports::SendMessageA(Slider, TBM_SETPOS, 1, ScenarioClass::Instance->Level);
 
67
        }
 
68
}
 
69
 
 
70
void Dialogs::Illuminati::Apply(HWND hwndDlg, bool Close) {
 
71
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_R)) {
 
72
                ScenarioClass::Instance->Red = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
73
        }
 
74
 
 
75
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_G)) {
 
76
                ScenarioClass::Instance->Green = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
77
        }
 
78
 
 
79
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_B)) {
 
80
                ScenarioClass::Instance->Blue = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
81
        }
 
82
 
 
83
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_AMBIENT)) {
 
84
                ScenarioClass::Instance->AmbientTarget = ScenarioClass::Instance->AmbientCurrent = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
85
        }
 
86
 
 
87
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_GROUND)) {
 
88
                ScenarioClass::Instance->Ground = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
89
        }
 
90
 
 
91
        if(HWND Slider = Imports::GetDlgItem(hwndDlg, ARES_ILLUMINATI_SLIDER_LEVEL)) {
 
92
                ScenarioClass::Instance->Level = Imports::SendMessageA(Slider, TBM_GETPOS, 0, 0);
 
93
        }
 
94
 
 
95
        ScenarioClass::RecalcLighting(10 * ScenarioClass::Instance->Red, 10 * ScenarioClass::Instance->Green, 10 * ScenarioClass::Instance->Blue, 0);
 
96
        MouseClass::Instance->DrawOnTop();
 
97
        if(Close) {
 
98
                LONG status = Imports::GetWindowLongA(hwndDlg, 8);
 
99
                LONG *statusPtr = (LONG *)status;
 
100
                *statusPtr = 1;
 
101
        }
 
102
}