Rev 214 | Rev 220 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 214 | Rev 219 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef RENDERTYPEWIN
|
1 | #ifndef RENDERTYPEWIN
|
2 | #error Only for Windows
|
2 | #error Only for Windows
|
3 | #endif
|
3 | #endif
|
4 | 4 | ||
5 | #include "duke3d.h"
|
5 | #include "duke3d.h"
|
- | 6 | #include "sounds.h"
|
|
6 | 7 | ||
7 | #include "build.h"
|
8 | #include "build.h"
|
8 | #include "winlayer.h"
|
9 | #include "winlayer.h"
|
9 | #include "compat.h"
|
10 | #include "compat.h"
|
10 | 11 | ||
Line 21... | Line 22... | ||
21 | 22 | ||
22 | #define TAB_CONFIG 0
|
23 | #define TAB_CONFIG 0
|
23 | #define TAB_GAME 1
|
24 | #define TAB_GAME 1
|
24 | #define TAB_MESSAGES 2
|
25 | #define TAB_MESSAGES 2
|
25 | 26 | ||
- | 27 | static struct audioenumdrv *wavedevs = NULL; |
|
- | 28 | ||
26 | static struct { |
29 | static struct { |
27 | int fullscreen; |
30 | int fullscreen; |
28 | int xdim, ydim, bpp; |
31 | int xdim, ydim, bpp; |
29 | int forcesetup; |
32 | int forcesetup; |
30 | int usemouse, usejoy; |
33 | int usemouse, usejoy; |
Line 33... | Line 36... | ||
33 | 36 | ||
34 | static HWND startupdlg = NULL; |
37 | static HWND startupdlg = NULL; |
35 | static HWND pages[3] = { NULL, NULL, NULL }; |
38 | static HWND pages[3] = { NULL, NULL, NULL }; |
36 | static int done = -1, mode = TAB_CONFIG; |
39 | static int done = -1, mode = TAB_CONFIG; |
37 | 40 | ||
- | 41 | #define POPULATE_VIDEO 1
|
|
- | 42 | #define POPULATE_CONFIG 2
|
|
- | 43 | #define POPULATE_GAME 4
|
|
- | 44 | ||
38 | static void PopulateForm(int pgs) |
45 | static void PopulateForm(int pgs) |
39 | {
|
46 | {
|
40 | HWND hwnd;
|
47 | HWND hwnd;
|
41 | if (pgs & (1<<TAB_CONFIG)) { |
48 | char buf[256]; |
42 | int i,j; |
49 | int i,j; |
- | 50 | ||
43 | char buf[64]; |
51 | if (pgs & POPULATE_VIDEO) { |
44 | int mode; |
52 | int mode; |
45 | 53 | ||
46 | hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); |
54 | hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); |
47 | 55 | ||
48 | mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1); |
56 | mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1); |
Line 56... | Line 64... | ||
56 | break; |
64 | break; |
57 | }
|
65 | }
|
58 | }
|
66 | }
|
59 | 67 | ||
60 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); |
68 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); |
61 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); |
- | |
62 | - | ||
63 | ComboBox_ResetContent(hwnd); |
69 | ComboBox_ResetContent(hwnd); |
64 | for (i=0; i<validmodecnt; i++) { |
70 | for (i=0; i<validmodecnt; i++) { |
65 | if (validmode[i].fs != settings.fullscreen) continue; |
71 | if (validmode[i].fs != settings.fullscreen) continue; |
66 | 72 | ||
67 | // all modes get added to the 3D mode list
|
73 | // all modes get added to the 3D mode list
|
68 | Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); |
74 | Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); |
69 | j = ComboBox_AddString(hwnd, buf); |
75 | j = ComboBox_AddString(hwnd, buf); |
70 | ComboBox_SetItemData(hwnd, j, i); |
76 | ComboBox_SetItemData(hwnd, j, i); |
71 | if (i == mode) ComboBox_SetCurSel(hwnd, j); |
77 | if (i == mode) ComboBox_SetCurSel(hwnd, j); |
72 | }
|
78 | }
|
- | 79 | }
|
|
- | 80 | ||
- | 81 | if (pgs & POPULATE_CONFIG) { |
|
- | 82 | struct audioenumdev *d; |
|
- | 83 | char *n; |
|
- | 84 | ||
- | 85 | hwnd = GetDlgItem(pages[TAB_CONFIG], IDCSOUNDDRV); |
|
- | 86 | ComboBox_ResetContent(hwnd); |
|
- | 87 | if (wavedevs) { |
|
- | 88 | d = wavedevs->devs; |
|
- | 89 | for (i=0; wavedevs->drvs[i]; i++) { |
|
- | 90 | strcpy(buf, wavedevs->drvs[i]); |
|
- | 91 | if (d->devs) { |
|
- | 92 | strcat(buf, ":"); |
|
- | 93 | n = buf + strlen(buf); |
|
- | 94 | for (j=0; d->devs[j]; j++) { |
|
- | 95 | strcpy(n, d->devs[j]); |
|
- | 96 | ComboBox_AddString(hwnd, buf); |
|
- | 97 | }
|
|
- | 98 | } else { |
|
- | 99 | ComboBox_AddString(hwnd, buf); |
|
- | 100 | }
|
|
- | 101 | d = d->next; |
|
- | 102 | }
|
|
- | 103 | }
|
|
- | 104 | ||
- | 105 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); |
|
73 | 106 | ||
74 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED)); |
107 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED)); |
75 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED)); |
108 | Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED)); |
76 | }
|
109 | }
|
77 | 110 | ||
78 | if (pgs & (1<<TAB_GAME)) { |
111 | if (pgs & POPULATE_GAME) { |
79 | struct grpfile *fg; |
112 | struct grpfile *fg; |
80 | int i, j; |
113 | int i, j; |
81 | char buf[128+BMAX_PATH]; |
114 | char buf[128+BMAX_PATH]; |
82 | 115 | ||
83 | hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA); |
116 | hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA); |
Line 100... | Line 133... | ||
100 | switch (uMsg) { |
133 | switch (uMsg) { |
101 | case WM_COMMAND: |
134 | case WM_COMMAND: |
102 | switch (LOWORD(wParam)) { |
135 | switch (LOWORD(wParam)) { |
103 | case IDCFULLSCREEN: |
136 | case IDCFULLSCREEN: |
104 | settings.fullscreen = !settings.fullscreen; |
137 | settings.fullscreen = !settings.fullscreen; |
105 | PopulateForm(1<<TAB_CONFIG); |
138 | PopulateForm(POPULATE_VIDEO); |
106 | return TRUE; |
139 | return TRUE; |
107 | case IDCVMODE: |
140 | case IDCVMODE: |
108 | if (HIWORD(wParam) == CBN_SELCHANGE) { |
141 | if (HIWORD(wParam) == CBN_SELCHANGE) { |
109 | int i; |
142 | int i; |
110 | i = ComboBox_GetCurSel((HWND)lParam); |
143 | i = ComboBox_GetCurSel((HWND)lParam); |
Line 463... | Line 496... | ||
463 | if (!startupdlg) return 1; |
496 | if (!startupdlg) return 1; |
464 | 497 | ||
465 | done = -1; |
498 | done = -1; |
466 | 499 | ||
467 | ScanGroups(); |
500 | ScanGroups(); |
- | 501 | #ifdef JFAUD
|
|
- | 502 | EnumAudioDevs(&wavedevs, NULL, NULL); |
|
468 | 503 | #endif
|
|
469 | SetPage(TAB_CONFIG); |
504 | SetPage(TAB_CONFIG); |
470 | EnableConfig(1); |
505 | EnableConfig(1); |
471 | 506 | ||
472 | settings.fullscreen = ScreenMode; |
507 | settings.fullscreen = ScreenMode; |
473 | settings.xdim = ScreenWidth; |
508 | settings.xdim = ScreenWidth; |
Line 502... | Line 537... | ||
502 | UseMouse = settings.usemouse; |
537 | UseMouse = settings.usemouse; |
503 | UseJoystick = settings.usejoy; |
538 | UseJoystick = settings.usejoy; |
504 | duke3dgrp = settings.selectedgrp; |
539 | duke3dgrp = settings.selectedgrp; |
505 | }
|
540 | }
|
506 | 541 | ||
- | 542 | #ifdef JFAUD
|
|
- | 543 | if (wavedevs) { |
|
- | 544 | struct audioenumdev *d, *e; |
|
- | 545 | free(wavedevs->drvs); |
|
- | 546 | for (e=wavedevs->devs; e; e=d) { |
|
- | 547 | d = e->next; |
|
- | 548 | if (e->devs) free(e->devs); |
|
- | 549 | free(e); |
|
- | 550 | }
|
|
- | 551 | free(wavedevs); |
|
- | 552 | }
|
|
- | 553 | #endif
|
|
- | 554 | ||
507 | return done; |
555 | return done; |
508 | }
|
556 | }
|
509 | 557 |