(a)As used in this section, unless the context clearly requires otherwise:
(1)"Complaint" includes a cross-complaint.
(2)"Defendant" includes a cross-defendant or a person against whom a complaint is filed.
(3)"Plaintiff" includes a cross-complainant or a party who files a complaint in intervention.
(4)"Prevailing party" includes the party with a net monetary recovery, a defendant in whose favor a dismissal is entered, a defendant where neither plaintiff nor defendant obtains any relief, and a defendant as against those plaintiffs who do not recover any relief against that defendant. When any party recovers other than monetary relief and in situations other than as specified, the "prevailing party" shall be as determined by the court, and under those circumstances, the court, in its discretion, may allow costs or not and, if allowed may apportion costs between the parties on the same or adverse sides pursuant to rules adopted under Section 1034.
(b)Except as otherwise expressly provided by statute, a prevailing party is entitled as a matter of right to recover costs in any action or proceeding.
(c)Nothing in this section shall prohibit parties from stipulating to alternative procedures for awarding costs in the litigation pursuant to rules adopted under Section 1034.