gosu 1.4.5.pre1 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/lib/SDL2.dll +0 -0
  99. data/lib64/SDL2.dll +0 -0
  100. data/src/Window.cpp +3 -0
  101. metadata +5 -4
@@ -21,6 +21,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
21
21
  BYTE oldparam[MAX_CHANNELS];
22
22
  BYTE chnvols[MAX_CHANNELS];
23
23
  DWORD patloop[MAX_CHANNELS];
24
+ UINT i;
24
25
 
25
26
  SDL_memset(instr, 0, sizeof(instr));
26
27
  SDL_memset(notes, 0, sizeof(notes));
@@ -28,13 +29,15 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
28
29
  SDL_memset(patloop, 0, sizeof(patloop));
29
30
  SDL_memset(oldparam, 0, sizeof(oldparam));
30
31
  SDL_memset(chnvols, 64, sizeof(chnvols));
31
- for (UINT icv=0; icv<_this->m_nChannels; icv++)
32
- chnvols[icv] = _this->ChnSettings[icv].nVolume;
32
+ for (i=0; i<_this->m_nChannels; i++)
33
+ chnvols[i] = _this->ChnSettings[i].nVolume;
33
34
  nMaxRow = _this->m_nNextRow;
34
35
  nMaxPattern = _this->m_nNextPattern;
35
36
  for (;;)
36
37
  {
37
38
  UINT nSpeedCount = 0;
39
+ MODCHANNEL *pChn;
40
+ MODCOMMAND *p;
38
41
  nRow = nNextRow;
39
42
  nCurrentPattern = nNextPattern;
40
43
  // Check if pattern is valid
@@ -67,7 +70,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
67
70
  }
68
71
  if (!nRow)
69
72
  {
70
- for (UINT ipck=0; ipck<_this->m_nChannels; ipck++) patloop[ipck] = dwElapsedTime;
73
+ for (i=0; i<_this->m_nChannels; i++) patloop[i] = dwElapsedTime;
71
74
  }
72
75
  if (!bTotal)
73
76
  {
@@ -81,16 +84,16 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
81
84
  break;
82
85
  }
83
86
  }
84
- MODCHANNEL *pChn = _this->Chn;
85
- MODCOMMAND *p = _this->Patterns[nPattern] + nRow * _this->m_nChannels;
86
- for (UINT nChn=0; nChn<_this->m_nChannels; p++,pChn++, nChn++) if (*((DWORD *)p))
87
+ pChn = _this->Chn;
88
+ p = _this->Patterns[nPattern] + nRow * _this->m_nChannels;
89
+ for (i=0; i<_this->m_nChannels; p++,pChn++, i++) if (*((DWORD *)p))
87
90
  {
88
91
  UINT command = p->command;
89
92
  UINT param = p->param;
90
93
  UINT note = p->note;
91
- if (p->instr) { instr[nChn] = p->instr; notes[nChn] = 0; vols[nChn] = 0xFF; }
92
- if ((note) && (note <= NOTE_MAX)) notes[nChn] = note;
93
- if (p->volcmd == VOLCMD_VOLUME) { vols[nChn] = p->vol; }
94
+ if (p->instr) { instr[i] = p->instr; notes[i] = 0; vols[i] = 0xFF; }
95
+ if ((note) && (note <= NOTE_MAX)) notes[i] = note;
96
+ if (p->volcmd == VOLCMD_VOLUME) { vols[i] = p->vol; }
94
97
  if (command) switch (command)
95
98
  {
96
99
  // Position Jump
@@ -150,9 +153,9 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
150
153
  if ((param & 0xF0) == 0xE0) nSpeedCount = (param & 0x0F) * nMusicSpeed; else
151
154
  if ((param & 0xF0) == 0x60)
152
155
  {
153
- if (param & 0x0F) dwElapsedTime += (dwElapsedTime - patloop[nChn]) * (param & 0x0F);
156
+ if (param & 0x0F) dwElapsedTime += (dwElapsedTime - patloop[i]) * (param & 0x0F);
154
157
  else {
155
- patloop[nChn] = dwElapsedTime;
158
+ patloop[i] = dwElapsedTime;
156
159
  if (_this->m_nType & MOD_TYPE_XM) nNextStartRow = nRow;
157
160
  }
158
161
  }
@@ -182,7 +185,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
182
185
  break;
183
186
  // Set Volume
184
187
  case CMD_VOLUME:
185
- vols[nChn] = param;
188
+ vols[i] = param;
186
189
  break;
187
190
  // Global Volume
188
191
  case CMD_GLOBALVOLUME:
@@ -221,27 +224,27 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
221
224
  if (nGlbVol > 256) nGlbVol = 256;
222
225
  break;
223
226
  case CMD_CHANNELVOLUME:
224
- if (param <= 64) chnvols[nChn] = param;
227
+ if (param <= 64) chnvols[i] = param;
225
228
  break;
226
229
  case CMD_CHANNELVOLSLIDE:
227
- if (param) oldparam[nChn] = param; else param = oldparam[nChn];
230
+ if (param) oldparam[i] = param; else param = oldparam[i];
228
231
  pChn->nOldChnVolSlide = param;
229
232
  if (((param & 0x0F) == 0x0F) && (param & 0xF0))
230
233
  {
231
- param = (param >> 4) + chnvols[nChn];
234
+ param = (param >> 4) + chnvols[i];
232
235
  } else
233
236
  if (((param & 0xF0) == 0xF0) && (param & 0x0F))
234
237
  {
235
- if (chnvols[nChn] > (int)(param & 0x0F)) param = chnvols[nChn] - (param & 0x0F);
238
+ if (chnvols[i] > (int)(param & 0x0F)) param = chnvols[i] - (param & 0x0F);
236
239
  else param = 0;
237
240
  } else
238
241
  if (param & 0x0F)
239
242
  {
240
243
  param = (param & 0x0F) * nMusicSpeed;
241
- param = (chnvols[nChn] > param) ? chnvols[nChn] - param : 0;
242
- } else param = ((param & 0xF0) >> 4) * nMusicSpeed + chnvols[nChn];
244
+ param = (chnvols[i] > param) ? chnvols[i] - param : 0;
245
+ } else param = ((param & 0xF0) >> 4) * nMusicSpeed + chnvols[i];
243
246
  if (param > 64) param = 64;
244
- chnvols[nChn] = param;
247
+ chnvols[i] = param;
245
248
  break;
246
249
  }
247
250
  }
@@ -253,15 +256,15 @@ EndMod:
253
256
  {
254
257
  _this->m_nGlobalVolume = nGlbVol;
255
258
  _this->m_nOldGlbVolSlide = nOldGlbVolSlide;
256
- for (UINT n=0; n<_this->m_nChannels; n++)
259
+ for (i=0; i<_this->m_nChannels; i++)
257
260
  {
258
- _this->Chn[n].nGlobalVol = chnvols[n];
259
- if (notes[n]) _this->Chn[n].nNewNote = notes[n];
260
- if (instr[n]) _this->Chn[n].nNewIns = instr[n];
261
- if (vols[n] != 0xFF)
261
+ _this->Chn[i].nGlobalVol = chnvols[i];
262
+ if (notes[i]) _this->Chn[i].nNewNote = notes[i];
263
+ if (instr[i]) _this->Chn[i].nNewIns = instr[i];
264
+ if (vols[i] != 0xFF)
262
265
  {
263
- if (vols[n] > 64) vols[n] = 64;
264
- _this->Chn[n].nVolume = vols[n] << 2;
266
+ if (vols[i] > 64) vols[i] = 64;
267
+ _this->Chn[i].nVolume = vols[i] << 2;
265
268
  }
266
269
  }
267
270
  }
@@ -276,15 +279,19 @@ void CSoundFile_InstrumentChange(CSoundFile *_this, MODCHANNEL *pChn, UINT instr
276
279
  //--------------------------------------------------------------------------------------------------------
277
280
  {
278
281
  BOOL bInstrumentChanged = FALSE;
282
+ UINT note;
283
+ INSTRUMENTHEADER *penv;
284
+ MODINSTRUMENT *psmp;
279
285
 
280
286
  if (instr >= MAX_INSTRUMENTS) return;
281
- INSTRUMENTHEADER *penv = _this->Headers[instr];
282
- MODINSTRUMENT *psmp = &_this->Ins[instr];
283
- UINT note = pChn->nNewNote;
287
+ penv = _this->Headers[instr];
288
+ psmp = &_this->Ins[instr];
289
+ note = pChn->nNewNote;
284
290
  if ((penv) && (note) && (note <= 128))
285
291
  {
292
+ UINT n;
286
293
  if (penv->NoteMap[note-1] >= 0xFE) return;
287
- UINT n = penv->Keyboard[note-1];
294
+ n = penv->Keyboard[note-1];
288
295
  psmp = ((n) && (n < MAX_SAMPLES)) ? &_this->Ins[n] : NULL;
289
296
  } else
290
297
  if (_this->m_nInstruments)
@@ -406,10 +413,11 @@ void CSoundFile_InstrumentChange(CSoundFile *_this, MODCHANNEL *pChn, UINT instr
406
413
  void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta, BOOL bResetEnv)
407
414
  //---------------------------------------------------------------------------
408
415
  {
409
- if (note < 1) return;
410
416
  MODCHANNEL * const pChn = &_this->Chn[nChn];
411
417
  MODINSTRUMENT *pins = pChn->pInstrument;
412
418
  INSTRUMENTHEADER *penv = pChn->pHeader;
419
+ UINT period;
420
+ if (note < 1) return;
413
421
  if ((penv) && (note <= 0x80))
414
422
  {
415
423
  UINT n = penv->Keyboard[note - 1];
@@ -448,7 +456,7 @@ void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta,
448
456
  if (note > 132) note = 132;
449
457
  pChn->nNote = note;
450
458
  if ((!bPorta) || (_this->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT))) pChn->nNewIns = 0;
451
- UINT period = CSoundFile_GetPeriodFromNote(_this, note, pChn->nFineTune, pChn->nC4Speed);
459
+ period = CSoundFile_GetPeriodFromNote(_this, note, pChn->nFineTune, pChn->nC4Speed);
452
460
  if (period)
453
461
  {
454
462
  if ((!bPorta) || (!pChn->nPeriod)) pChn->nPeriod = period;
@@ -510,6 +518,7 @@ void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta,
510
518
  // Enable Ramping
511
519
  if (!bPorta)
512
520
  {
521
+ BOOL bFlt;
513
522
  pChn->dwFlags &= ~CHN_FILTER;
514
523
  pChn->dwFlags |= CHN_FASTVOLRAMP;
515
524
  pChn->nRetrigCount = 0;
@@ -542,7 +551,7 @@ void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta,
542
551
  pChn->nAutoVibPos = 0;
543
552
  }
544
553
  pChn->nLeftVol = pChn->nRightVol = 0;
545
- BOOL bFlt = (_this->m_dwSongFlags & SONG_MPTFILTERMODE) ? FALSE : TRUE;
554
+ bFlt = (_this->m_dwSongFlags & SONG_MPTFILTERMODE) ? FALSE : TRUE;
546
555
  // Setup Initial Filter for this note
547
556
  if (penv)
548
557
  {
@@ -565,17 +574,21 @@ UINT CSoundFile_GetNNAChannel(CSoundFile *_this, UINT nChn)
565
574
  const MODCHANNEL *pChn = &_this->Chn[nChn];
566
575
  // Check for empty channel
567
576
  const MODCHANNEL *pi = &_this->Chn[_this->m_nChannels];
568
- for (UINT i=_this->m_nChannels; i<MAX_CHANNELS; i++, pi++) if (!pi->nLength) return i;
577
+ const MODCHANNEL *pj;
578
+ UINT j, result;
579
+ DWORD vol, envpos;
580
+ for (j=_this->m_nChannels; j<MAX_CHANNELS; j++, pi++) if (!pi->nLength) return j;
569
581
  if (!pChn->nFadeOutVol) return 0;
570
582
  // All channels are used: check for lowest volume
571
- UINT result = 0;
572
- DWORD vol = 64*65536; // 25%
573
- DWORD envpos = 0xFFFFFF;
574
- const MODCHANNEL *pj = &_this->Chn[_this->m_nChannels];
575
- for (UINT j=_this->m_nChannels; j<MAX_CHANNELS; j++, pj++)
583
+ result = 0;
584
+ vol = 64*65536; // 25%
585
+ envpos = 0xFFFFFF;
586
+ pj = &_this->Chn[_this->m_nChannels];
587
+ for (j=_this->m_nChannels; j<MAX_CHANNELS; j++, pj++)
576
588
  {
589
+ DWORD v;
577
590
  if (!pj->nFadeOutVol) return j;
578
- DWORD v = pj->nVolume;
591
+ v = pj->nVolume;
579
592
  if (pj->dwFlags & CHN_NOTEFADE)
580
593
  v = v * pj->nFadeOutVol;
581
594
  else
@@ -597,7 +610,9 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
597
610
  {
598
611
  MODCHANNEL *pChn = &_this->Chn[nChn];
599
612
  INSTRUMENTHEADER *penv = pChn->pHeader, *pHeader = 0;
613
+ MODCHANNEL *p;
600
614
  signed char *pSample;
615
+ UINT i, n;
601
616
  if (note > 0x80) note = 0;
602
617
  if (note < 1) return;
603
618
  // Always NNA cut - using
@@ -606,9 +621,9 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
606
621
  if ((_this->m_dwSongFlags & SONG_CPUVERYHIGH)
607
622
  || (!pChn->nLength) || (pChn->dwFlags & CHN_MUTE)
608
623
  || ((!pChn->nLeftVol) && (!pChn->nRightVol))) return;
609
- UINT n = CSoundFile_GetNNAChannel(_this, nChn);
624
+ n = CSoundFile_GetNNAChannel(_this, nChn);
610
625
  if (!n) return;
611
- MODCHANNEL *p = &_this->Chn[n];
626
+ p = &_this->Chn[n];
612
627
  // Copy Channel
613
628
  SDL_memcpy(p, pChn, sizeof (*p));
614
629
  p->dwFlags &= ~(CHN_VIBRATO|CHN_TREMOLO|CHN_PANBRELLO|CHN_MUTE|CHN_PORTAMENTO);
@@ -631,7 +646,7 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
631
646
  pHeader = _this->Headers[instr];
632
647
  if (pHeader)
633
648
  {
634
- UINT n = 0;
649
+ n = 0;
635
650
  if (note <= 0x80)
636
651
  {
637
652
  n = pHeader->Keyboard[note-1];
@@ -641,8 +656,8 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
641
656
  } else pSample = NULL;
642
657
  }
643
658
  if (!penv) return;
644
- MODCHANNEL *p = pChn;
645
- for (UINT i=nChn; i<MAX_CHANNELS; p++, i++)
659
+ p = pChn;
660
+ for (i=nChn; i<MAX_CHANNELS; p++, i++)
646
661
  if ((i >= _this->m_nChannels) || (p == pChn))
647
662
  {
648
663
  if (((p->nMasterChn == nChn+1) || (p == pChn)) && (p->pHeader))
@@ -695,7 +710,7 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
695
710
  // New Note Action
696
711
  if ((pChn->nVolume) && (pChn->nLength))
697
712
  {
698
- UINT n = CSoundFile_GetNNAChannel(_this, nChn);
713
+ n = CSoundFile_GetNNAChannel(_this, nChn);
699
714
  if (n)
700
715
  {
701
716
  p = &_this->Chn[n];
@@ -730,8 +745,9 @@ BOOL CSoundFile_ProcessEffects(CSoundFile *_this)
730
745
  {
731
746
  MODCHANNEL *pChn = _this->Chn;
732
747
  int nBreakRow = -1, nPosJump = -1, nPatLoopRow = -1;
748
+ UINT nChn;
733
749
 
734
- for (UINT nChn=0; nChn<_this->m_nChannels; nChn++, pChn++)
750
+ for (nChn=0; nChn<_this->m_nChannels; nChn++, pChn++)
735
751
  {
736
752
  UINT instr = pChn->nRowInstr;
737
753
  UINT volcmd = pChn->nRowVolCmd;
@@ -1232,7 +1248,8 @@ BOOL CSoundFile_ProcessEffects(CSoundFile *_this)
1232
1248
  {
1233
1249
  if (nPosJump != (int)_this->m_nCurrentPattern)
1234
1250
  {
1235
- for (UINT i=0; i<_this->m_nChannels; i++) _this->Chn[i].nPatternLoopCount = 0;
1251
+ UINT i;
1252
+ for (i=0; i<_this->m_nChannels; i++) _this->Chn[i].nPatternLoopCount = 0;
1236
1253
  }
1237
1254
  _this->m_nNextPattern = nPosJump;
1238
1255
  _this->m_nNextRow = (UINT)nBreakRow;
@@ -1462,8 +1479,9 @@ void CSoundFile_Panbrello(CSoundFile *_this, MODCHANNEL *p, UINT param)
1462
1479
  void CSoundFile_VolumeSlide(CSoundFile *_this, MODCHANNEL *pChn, UINT param)
1463
1480
  //--------------------------------------------------------
1464
1481
  {
1482
+ LONG newvolume;
1465
1483
  if (param) pChn->nOldVolumeSlide = param; else param = pChn->nOldVolumeSlide;
1466
- LONG newvolume = pChn->nVolume;
1484
+ newvolume = pChn->nVolume;
1467
1485
  if (_this->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_STM|MOD_TYPE_AMF))
1468
1486
  {
1469
1487
  if ((param & 0x0F) == 0x0F)
@@ -1700,7 +1718,8 @@ void CSoundFile_ExtendedS3MCommands(CSoundFile *_this, UINT nChn, UINT param)
1700
1718
  case 2:
1701
1719
  {
1702
1720
  MODCHANNEL *bkp = &_this->Chn[_this->m_nChannels];
1703
- for (UINT i=_this->m_nChannels; i<MAX_CHANNELS; i++, bkp++)
1721
+ UINT i;
1722
+ for (i=_this->m_nChannels; i<MAX_CHANNELS; i++, bkp++)
1704
1723
  {
1705
1724
  if (bkp->nMasterChn == nChn+1)
1706
1725
  {
@@ -1924,6 +1943,9 @@ void CSoundFile_RetrigNote(CSoundFile *_this, UINT nChn, UINT param)
1924
1943
  if (bDoRetrig)
1925
1944
  {
1926
1945
  UINT dv = (param >> 4) & 0x0F;
1946
+ BOOL bResetEnv = FALSE;
1947
+ UINT nNote;
1948
+ LONG nOldPeriod;
1927
1949
  if (dv)
1928
1950
  {
1929
1951
  int vol = pChn->nVolume;
@@ -1936,10 +1958,9 @@ void CSoundFile_RetrigNote(CSoundFile *_this, UINT nChn, UINT param)
1936
1958
  pChn->nVolume = vol;
1937
1959
  pChn->dwFlags |= CHN_FASTVOLRAMP;
1938
1960
  }
1939
- UINT nNote = pChn->nNewNote;
1940
- LONG nOldPeriod = pChn->nPeriod;
1961
+ nNote = pChn->nNewNote;
1962
+ nOldPeriod = pChn->nPeriod;
1941
1963
  if ((nNote) && (nNote <= NOTE_MAX) && (pChn->nLength)) CSoundFile_CheckNNA(_this, nChn, 0, nNote, TRUE);
1942
- BOOL bResetEnv = FALSE;
1943
1964
  if (_this->m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))
1944
1965
  {
1945
1966
  if ((pChn->nRowInstr) && (param < 0x100)) { CSoundFile_InstrumentChange(_this, pChn, pChn->nRowInstr, FALSE, FALSE, TRUE); bResetEnv = TRUE; }
@@ -2097,7 +2118,8 @@ int CSoundFile_PatternLoop(CSoundFile *_this, MODCHANNEL *pChn, UINT param)
2097
2118
  } else
2098
2119
  {
2099
2120
  MODCHANNEL *p = _this->Chn;
2100
- for (UINT i=0; i<_this->m_nChannels; i++, p++) if (p != pChn)
2121
+ UINT i;
2122
+ for (i=0; i<_this->m_nChannels; i++, p++) if (p != pChn)
2101
2123
  {
2102
2124
  // Loop already done
2103
2125
  if (p->nPatternLoopCount) return -1;
@@ -2187,6 +2209,8 @@ DWORD CSoundFile_IsSongFinished(CSoundFile *_this, UINT nStartOrder, UINT nStart
2187
2209
  BOOL CSoundFile_IsValidBackwardJump(CSoundFile *_this, UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow)
2188
2210
  //----------------------------------------------------------------------------------------------------------
2189
2211
  {
2212
+ BYTE row_hist[256];
2213
+ UINT nRows, row;
2190
2214
  while ((nJumpOrder < MAX_PATTERNS) && (_this->Order[nJumpOrder] == 0xFE)) nJumpOrder++;
2191
2215
  if ((nStartOrder >= MAX_PATTERNS) || (nJumpOrder >= MAX_PATTERNS)) return FALSE;
2192
2216
  // Treat only case with jumps in the same pattern
@@ -2194,19 +2218,21 @@ BOOL CSoundFile_IsValidBackwardJump(CSoundFile *_this, UINT nStartOrder, UINT nS
2194
2218
  if ((nJumpOrder < nStartOrder) || (nJumpRow >= _this->PatternSize[nStartOrder])
2195
2219
  || (!_this->Patterns[nStartOrder]) || (nStartRow >= 256) || (nJumpRow >= 256)) return FALSE;
2196
2220
  // See if the pattern is being played backward
2197
- BYTE row_hist[256];
2198
2221
  SDL_memset(row_hist, 0, sizeof(row_hist));
2199
- UINT nRows = _this->PatternSize[nStartOrder], row = nJumpRow;
2222
+ nRows = _this->PatternSize[nStartOrder], row = nJumpRow;
2200
2223
  if (nRows > 256) nRows = 256;
2201
2224
  row_hist[nStartRow] = TRUE;
2202
2225
  while ((row < 256) && (!row_hist[row]))
2203
2226
  {
2227
+ MODCOMMAND *p;
2228
+ int breakrow, posjump;
2229
+ UINT i;
2204
2230
  if (row >= nRows) return TRUE;
2205
2231
  row_hist[row] = TRUE;
2206
- MODCOMMAND *p = _this->Patterns[nStartOrder] + row * _this->m_nChannels;
2232
+ p = _this->Patterns[nStartOrder] + row * _this->m_nChannels;
2207
2233
  row++;
2208
- int breakrow = -1, posjump = 0;
2209
- for (UINT i=0; i<_this->m_nChannels; i++, p++)
2234
+ breakrow = -1, posjump = 0;
2235
+ for (i=0; i<_this->m_nChannels; i++, p++)
2210
2236
  {
2211
2237
  if (p->command == CMD_POSITIONJUMP)
2212
2238
  {
@@ -2236,11 +2262,12 @@ BOOL CSoundFile_IsValidBackwardJump(CSoundFile *_this, UINT nStartOrder, UINT nS
2236
2262
  UINT CSoundFile_GetNoteFromPeriod(CSoundFile *_this, UINT period)
2237
2263
  //---------------------------------------------------
2238
2264
  {
2265
+ UINT i;
2239
2266
  if (!period) return 0;
2240
2267
  if (_this->m_nType & (MOD_TYPE_MED|MOD_TYPE_MOD|MOD_TYPE_MTM|MOD_TYPE_669|MOD_TYPE_OKT|MOD_TYPE_AMF0))
2241
2268
  {
2242
2269
  period >>= 2;
2243
- for (UINT i=0; i<6*12; i++)
2270
+ for (i=0; i<6*12; i++)
2244
2271
  {
2245
2272
  if (period >= ProTrackerPeriodTable[i])
2246
2273
  {
@@ -2256,7 +2283,7 @@ UINT CSoundFile_GetNoteFromPeriod(CSoundFile *_this, UINT period)
2256
2283
  return 6*12+36;
2257
2284
  } else
2258
2285
  {
2259
- for (UINT i=1; i<NOTE_MAX; i++)
2286
+ for (i=1; i<NOTE_MAX; i++)
2260
2287
  {
2261
2288
  LONG n = CSoundFile_GetPeriodFromNote(_this, i, 0, 0);
2262
2289
  if ((n > 0) && (n <= (LONG)period)) return i;
@@ -2304,9 +2331,10 @@ UINT CSoundFile_GetPeriodFromNote(CSoundFile *_this, UINT note, int nFineTune, U
2304
2331
  UINT roct = note / 12;
2305
2332
  int rfine = finetune / 16;
2306
2333
  int i = rnote + rfine + 8;
2334
+ UINT per1, per2;
2307
2335
  if (i < 0) i = 0;
2308
2336
  if (i >= 104) i = 103;
2309
- UINT per1 = XMPeriodTable[i];
2337
+ per1 = XMPeriodTable[i];
2310
2338
  if ( finetune < 0 )
2311
2339
  {
2312
2340
  rfine--;
@@ -2315,7 +2343,7 @@ UINT CSoundFile_GetPeriodFromNote(CSoundFile *_this, UINT note, int nFineTune, U
2315
2343
  i = rnote+rfine+8;
2316
2344
  if (i < 0) i = 0;
2317
2345
  if (i >= 104) i = 103;
2318
- UINT per2 = XMPeriodTable[i];
2346
+ per2 = XMPeriodTable[i];
2319
2347
  rfine = finetune & 0x0F;
2320
2348
  per1 *= 16-rfine;
2321
2349
  per2 *= rfine;
@@ -2359,5 +2387,3 @@ UINT CSoundFile_GetFreqFromPeriod(CSoundFile *_this, UINT period, UINT nC4Speed,
2359
2387
  }
2360
2388
  }
2361
2389
  }
2362
-
2363
-