Commit Graph
245 Commits
Author SHA1 Message Date
John Bauer 7ebfd65a9b Make it so .sm files can contain \-escaped characters. Also, make the
writer for .dwi files replace control characters with dwi-safe characters.
Other file formats are unaffected.
2006-12-01 22:15:26 +00:00
Steve Checkoway 24a5651f0e Remove all items from a collection equal to a particular element in linear time. Only really useful for Sequences. 2006-11-03 04:46:36 +00:00
Steve Checkoway d571048d2b This is overkill for such a simple operation. Doing it this way should optimize to a single add and it doesn't have any of the problems associated with breaking aliasing rules. 2006-11-01 11:30:41 +00:00
Steve Checkoway cf3a76b600 Doing these conversions through a union is not safe either but more to the point, it isn't what's happening here. 2006-11-01 11:19:52 +00:00
Steve Checkoway e3e5cf77e5 Don't include Foreach.h in RageUtil.h which does not use it. Instead, include it in the individual files that actually use it. 2006-11-01 11:18:46 +00:00
John Bauer 37f9178f61 Add an "Autosync Tempo" feature. This uses a linear Least Squares
Regression to figure out a line through the user's step errors to minimize
that error.  It then uses the slope of that line to fix the tempo and the
intercept to fix the offset.  Stops are adjusted as if they were originally
calculated as a number of beats, ie the slope is also used to change
the stops.

Also fixed is a bug where the user doesn't get a chance to keep or
reject the sync changes when ESCing (ZZing) from a song.

R=glenn
2006-10-26 22:41:40 +00:00
Glenn Maynard 508aaa2857 remove unused 2006-10-18 20:02:26 +00:00
Glenn Maynard f7f21e2b8c Replace PRNG with a standard MT.
RandomGen r; r(); now generates [0,2^31-1] on 32-bit platforms,
not [0,2^31-2].  No longer uses MAX_INT, so the default behavior
doesn't depend on the size of an int.

RandomInt no longer generates a float and truncates it.  That
limited the values that could be returned to those that fit in
a 32-bit float.

Remove NR code.  It's not free.

This code is not threadsafe.  Locking access would kill performance.
The old code wasn't, either.  I think most symptoms would be
innocuous enough to not worry about.
2006-10-18 02:28:06 +00:00
Glenn Maynard 08ca0d7721 hide RandomFloat(seed) interface
hide randseed
2006-10-18 01:46:15 +00:00
Glenn Maynard e999775807 remove unused 2006-10-12 21:22:55 +00:00
Glenn Maynard 6c0264620e probably safer: ConvertValue 2006-10-12 02:03:47 +00:00
Glenn Maynard 30fd6d77b4 maybe workaround g++ 3.3 weirdness 2006-10-07 08:56:12 +00:00
Glenn Maynard 82f51bc3d4 more generic type-punning helper 2006-10-07 08:17:15 +00:00
Glenn Maynard d882f21348 make ToString and FromString templates 2006-10-07 06:21:39 +00:00
Glenn Maynard 8e0f7845f8 split directx and windows-specific stuff out of RageUtil 2006-09-18 22:42:52 +00:00
Glenn Maynard 76b7307c73 remove unused 2006-09-18 20:14:28 +00:00
Steve Checkoway af20d30581 Unused. 2006-09-14 09:33:06 +00:00
Steve Checkoway dc98ba4190 StringToFloat overload. Returns true if the entire string is a valid, finite float. 2006-09-02 23:26:07 +00:00
Steve Checkoway df9d1f13b1 Allow calculation of a better estimator (still not quite unbiased) for the population standard deviation from a sample. The result will be slightly too low still, but not by very much. 2006-08-19 20:43:43 +00:00
Chris Danford 339e9de36a clamp to 8 different note colors so that NoteSkins can implement colors efficiently in power-of-2 texture sizes 2006-08-08 02:27:59 +00:00
Glenn Maynard f0ba8c3322 "ARRAY_SIZE" is also stomped on by Windows headers.
Add "ARRAYLEN"; remove ARRAYSIZE after transition.
2006-07-25 04:51:17 +00:00
Steve Checkoway a07e194cf1 Revert. Fixes Linux build. 2006-07-18 05:51:37 +00:00
Jason Felds 366c3440d4 Fix VC8 macro redef warning. (more to come) 2006-07-18 03:56:37 +00:00
Steve Checkoway 8c9577ffe9 Unneeded. Vectors are a type of EqualityComparable.
http://www.sgi.com/tech/stl/EqualityComparable.html
If a particular implementation of the stl isn't c++98 compliant, a global
template<typename T>
bool operator==( const vector<T> &a, const vector<T> &b)
can be written (and operator!= of course).
2006-07-08 07:10:13 +00:00
Steve Checkoway a942c021c7 Cleanup. 2006-07-08 07:07:50 +00:00
Steve Checkoway 80698277cf Don't use rand()%n. The function specified by the ANSI committee is a terrible linear congruential generator. In fact, it's so bad that the low order bit alternates. The algorithm implemented as RandomFloat() seems to be Park and Miller's "minimum standard" generator which is better (but not great). [See Knuth for more information.]
Any place where you would use rand()%n, use RandomInt(0, n) instead.
2006-06-26 12:14:30 +00:00
Chris Danford 304d4c33ae add HexToBinary, move to RageUtil 2006-06-25 04:21:58 +00:00
Steve Checkoway da87f6d956 Use safe macros. 2006-06-24 00:05:08 +00:00
Steve Checkoway a45880281a Wrap strtof. Return 0 on nonfinite values. 2006-06-12 06:36:36 +00:00
Glenn Maynard f0fd06f92c add ConvertCodepageToWString, ConvertACPToUTF8
change ConvertWstringToACP -> ConvertWstringToCodepage
2006-04-04 23:38:09 +00:00
Chris Danford 865dcb072b remove unnecessary CLAMP in RandomGen 2006-03-28 21:52:10 +00:00
Chris Danford f9d50da5e1 cleanup for easier debugging 2006-03-28 19:15:44 +00:00
Chris Danford b3c4c6d86d remove assert. It's a little risky without more testing 2006-03-28 04:36:49 +00:00
Chris Danford 6d865d4762 fix RandomGen off by 1. Was retruning.[0,max), not [0,max]. (Caused random courseEntries to never pick the last song in the list) 2006-03-27 21:55:34 +00:00
Chris Danford 59aaab0375 assert( l < h ) in CLAMP 2006-03-27 10:59:13 +00:00
Glenn Maynard f9f990f590 support UTF-8 through ISO-8859-1 in MakeUpper, MakeLower, Capitalize 2006-03-01 02:45:42 +00:00
Glenn Maynard 3d86168ebb g_Uptab -> g_UpperCase 2006-03-01 01:04:02 +00:00
Glenn Maynard bcc8984b93 detach uptab from char_traits_char_nocase 2006-03-01 00:24:59 +00:00
Glenn Maynard 26e8fbd0ae detach uptab from char_traits_char_nocase 2006-03-01 00:24:25 +00:00
Glenn Maynard 18fbd2e8a4 take a char* for utf8_to_wchar 2006-03-01 00:14:50 +00:00
Glenn Maynard 3a1d3883b5 unsigned 2006-03-01 00:11:59 +00:00
Steve Checkoway e76f7c7902 Add helper function for removing objects from STL containers. mem_fun() and mem_fun_ref() are handy for using const (?) member functions as predicates. 2006-02-19 06:04:34 +00:00
Chris Danford 53e0ea8f24 fix smpackage uninstall and install to different installation other than where tools.exe resides 2006-02-15 03:58:29 +00:00
Glenn Maynard 478de001c6 move URLEncode into RageUtil 2006-02-09 00:08:10 +00:00
Chris Danford 884b8048f3 RString -> const RString & for easier stepping 2006-02-03 19:23:50 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Chris Danford 477e67a8aa fix smpackage file routines and registry writing 2006-01-21 12:18:26 +00:00
Glenn Maynard f9361c9036 interp -> lerp ("interp" doesn't imply linear) 2006-01-21 07:26:20 +00:00
Glenn Maynard f1f76f4c75 unused 2006-01-20 06:35:51 +00:00
Glenn Maynard f3d3100d36 cleanup 2006-01-20 06:30:13 +00:00